Our goal here is to have an automated way to run the project test suite, and if everything goes well, to build a new image that only contains the release and push it to the production environment.
For this, we'll use a specific compose file, docker-compose.test.yml, which performs two steps: first, it spins up the release service that builds the release, runs the tests, and tags the image as release_prepared:latest. Then, it spins up the app service that creates the final image by copying the release from the previous image:
$ cat umbrella/docker-compose.test.ymlversion: '2.3'services: app: # ... release: image: release_prepared:latest build: context: . dockerfile: Dockerfile env_file: - ./env/test.env ...