i developed an application using Angular, Spring Boot and MySQL database. I want do publish it into docker hub but im still confused if i should create different images for each (Angular, API SpringBoot and MySQL) or i should just put it all in one docker image
I tried dockerizing only the spring boot api but my doubs still remains about the whole app
CodePudding user response:
The backend and frontend should be in the same image. Depending if the backend or frontend is shared with other services you can think to make seperate images. If they are not shared it doesnt make sense to make two images because your frontend is not working without your backend and vice verser.
The Database should be in a seperate image, it is not part of your application, it is part of your data storage and could be easily shared with other applications.
CodePudding user response:
Good practice is putting them separately.
To make your application more flexible, you may define all accesses as an environment variable of the image.
That is to say, defining the base url of your backend as ENV, the access to your database as ENV
After that, you could leverage docker-compose to orchestrate it all