DEV Community

Discussion on: How to create a production Docker image

Collapse
 
zarkbe profile image
ZARk

Hello.
Why not use docker-compose?
The Point of docker containers is to get a more flexible architecture.

Collapse
 
abdorah profile image
Kotbi Abderrahmane

That's in fact a very good option for doing this. But I wanted to show also multiple stages building in docker.

Collapse
 
donut87 profile image
Christian Baer

An easy and solid way to do so, would be to use 2 different containers for building and deploying.
You build with a mvn container and copy only the .war file to the production container. This covers two aspects. First and foremost, the production docker image is much much smaller (no mvn, no compile logs, no other clutter) and second you can show the multi stage build.
Then use docker-compose, kubernetes or something of the like to start up your environment.