compose
compose copied to clipboard
Support multiple build contexts
Dockerfile 1.4 supports multiple build contexts - a way to specify them when building in compose would be great
I'd suggest something like:
services:
myapp:
build:
contexts:
additional: ../foo
deps: https://github.com/myvendor/deps
dist: https://somedistro.info/download/latest.tar.gz
Being able to drive this from environment / .env could be very powerful
Is there a roadmap or any updates on this? Thanks!
I suppose the ability to link targets/services to create build pipelines as in buildx bake
should also be accounted. :)
Are there any concrete plans on this issue yet?
Alternately, perhaps the ability to pass additional args to the build command? That way you could pass --build-context manually while waiting for the compose specification to support it natively.
This would solve the long-standing issue of having shared code between multiple containers in a docker compose project. Would the team be open to a pull request to implement this?
With buildx bake
I can build image from a compose file (see https://docs.docker.com/build/customize/bake/compose-file) :
# docker-compose.yml
services:
service_name:
build:
context: .
x-bake:
contexts:
context1: path
context2: path
And build with docker buildx bake -f docker-compose.yml service_name
But I don't know if we can up
a service using buildx / bake.
@kdubuc we can't; you can have a hybrid setup where you use bake for build and compose for running, but it'd be nice to have it all in compose
This would be a much appreciated feature, are there any updates/plans to implement it?
There is a PR on the Compose spec for supporting additional contexts during build. It seems to be ready to be merge soon
Yup. Follow up PR on compose-go
here, and I have the rest of the implementation ready to go for when that gets merged. Should be quick after the spec PR gets merged.