New Feature: Allow multiple compose files
What happened?
I can see here that multiple compose files are not supported. It would be good that at least the DockerComposeUp task supports this
What did you want to happen?
In our case, we have a multi gradle project with common external dependencies we would like to extends on each module (like Mongo and Localstack). Extending the common docker-compose-file with a templated docker-compose-override file would allow us to have those services defined in a single place.
Possible solution:
I would allow DockerComposeUp task to accept extra docker compose files
While DockerComposeUp only operates on single file that docker-compose file can reference other docker-compose files. It's a common pattern to define one global file with all the settings and many sub files that are specific compositions of services from that file.
docker-compose.yml
serviceA:
extends:
file: containers.yml
service: serviceA
containers.yml
serviceA:
container_name: <container-name>
image: <image>
...
Unfortunately, the extends keyword is not valid anymore starting v3 of docker-compose. Please refer to https://docs.docker.com/compose/extends/