-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow option to build image with Docker buildx Bake #311
Comments
This would be awesome! My team is evaluating the use of Docker buildx Bake to segment our Dockerfiles while keeping them DRY by having the build stages defined in one Dockerfile for reuse across all others. However, it becomes tricky if we then want to use the same Dockerfiles with Dev Containers, given that by taking advantage of advance bake file context features, the Dockerfiles themselves may not be as simple to rebuild, in the same manner, using singular Perhaps an additional top level keyword could be use, given that {
"name": "Example",
// Uncomment to bake image
"bake": {
"bakefiles": [ "../docker-bake.hcl" ],
"target": "foo",
"pull": "true",
"set": [
"target.args.mybuildarg=value",
"foo*.args.mybuildarg=value",
],
},
// Uncomment to build image
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"target": "foo",
"cacheFrom": [
"ghcr.io/pre/built:image"
]
},
// Uncomment to use pre-built image
"image": "pre/built:image",
} One hurtle may be in how current tools auto generate a Dockerfile to define the dev container image by appending subsequent stages to the original Dockerfile. If there is no single Dockerfile, what would be used instead. I'd propose adding a subsequent target that points the users provided target (or default target if none is specified from the
|
Well, in the meantime, I've found using the initializeCommand lifecycle-script to be a decent workaround. E.g:
|
It would be great to allow the option to use Docker's Bake cli tool to build images as well.
https://docs.docker.com/engine/reference/commandline/buildx_bake/
In my repos, we're using bake internally to build images (including sourcing remote docker bake files), it would be great to have this option as well so we could have parity with devcontainers.
Could potentially be merged with this feature request on allow extra flags to the buildx command #85
Thanks!
The text was updated successfully, but these errors were encountered: