compose-spec / compose-spec

The Compose specification

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include a remote source for a compose file

c-ameron opened this issue · comments

What is the problem you're trying to solve
I would like to extend the include function, to be able to source a compose file via a git repo/https.
This would allow me to have a template of docker-compose files which projects could source, and then override locally. In my org, this would be very useful as in many repos the docker-compose.yml file is usually the same, or at least requires very minor changes (which could be overridden with a minimal local compose file).
In your existing documentation, you already reference a pattern for using a local common compose file (../commons/compose.yaml). Having a remote version for this would remove copy/paste overhead, and make standardising and managing compose files a lot easier.

Describe the solution you'd like
You can specify a remote source (with the option of existing variable substitution to add in any auth tokens)

include:
   - source: https://${GITHUB_TOKEN}@github.com/docker/example.git#tag1
     path: compose.yaml

If you wanted to, you could also use the : delimiter for the filename/path, similar to how the remote url for the Dockerfile does it, ie

include:
   - source: https://github.com/docker/example2.git#tag1:folderA/compose.yaml

Additional context
Sourcing remote files is already possible for the Dockerfile or with the Bakefile. For me it would be a great addition to have compose files also have a similar remote functionality.

Thanks!