gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

New Feature: Allow multiple compose files

Open LionH opened this issue 5 years ago • 2 comments

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

LionH avatar Jul 16 '20 17:07 LionH

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>
    ...

robert3005 avatar Jul 23 '20 22:07 robert3005

Unfortunately, the extends keyword is not valid anymore starting v3 of docker-compose. Please refer to https://docs.docker.com/compose/extends/

LionH avatar Jul 23 '20 22:07 LionH