Hello. We have multiple services, some of them written in go, some in java. Some of them run on Alpine, another on Ubuntu.
The question is should we use separate Dockerfiles for build and for “run”?
In details: For now we have two docker-compose files, one for build-and-push-to-registry and another is to pull images from registry and deploy on staging/production.
The main idea is that we have separate docker-compose-run.yml
and docker-compose-build.yml
, also separate Dockerfiles for each container: Dockerfile-build
which actually build binaries from sources inside of container and Dockerfile-run
which just use image from registry and execute CMD.
Is this correct or I missed something? Thanks