How to correctly create Docker images for Angular + Spring application for development and...

Discussão em 'Angular' iniciado por BeGie, Janeiro 2, 2025.

  1. BeGie

    BeGie Guest

    I'm building an application with Angular as the frontend and Spring Boot as the backend. I want to create Docker images for both development and production environments but I'm unsure about the best approach.

    For development, I was considering using a docker-compose.dev.yml file where:

    Spring Boot is started with mvn spring-boot:run Angular is started with ng serve For production, I would create separate images where:

    The Spring Boot image uses mvn package to build the JAR file and includes it in the image. The Angular app is built with ng build --prod and served using NGINX or another web server

    Is this approach considered good practice, or is there a better way to handle development and production images? How should I structure my Dockerfiles and docker-compose files for such a setup? Are there any specific pitfalls I should watch out for when managing Angular + Spring Boot with Docker?

    Continue reading...

Compartilhe esta Página