Skip to content
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

Support bake file as build target #12581

Open
jalaziz opened this issue Feb 25, 2025 · 2 comments
Open

Support bake file as build target #12581

jalaziz opened this issue Feb 25, 2025 · 2 comments

Comments

@jalaziz
Copy link

jalaziz commented Feb 25, 2025

Description

Today, a docker compose file can service as a bake file. This is great when you already use a docker compose file for your build spec, but docker bake allows for much more robust and complex build configurations than what compose supports.

Now that Bake is GA, it would be great if we could instead specify a bake file and target as the build spec for a compose service. This would allow for much richer build definitions that are shared across development and production, while still allowing existing docker compose workflows to run as is.

Put another way, it would be wonderful if docker compose up --build could invoke a Bake build rather than only being able to reference a standard Dockerfile.

@ndeloof
Copy link
Contributor

ndeloof commented Feb 25, 2025

What do you have in mind as "more robust and complex build configurations" when it comes to a single image being built ?
AFAICT docker compose build definition gives you all the features bake supports, and actually latest Docker Compose release can rely on bake under the hood to run the build, which make multi-services sharing common resources build more efficient.

@jalaziz
Copy link
Author

jalaziz commented Feb 25, 2025

What do you have in mind as "more robust and complex build configurations" when it comes to a single image being built ?

Yes. Perhaps the most powerful feature of bake is being able to coordinate builds across dependencies. For example, with Bake, it's trivial to have a base image that is used in your final images and have it built automatically as needed. It's also trivial to use inheritance and targets to share a Dockerfile between a production build and debug-enabled dev build. Finally, Docker Bake supports functions.

AFAIK, none of what I've listed is supported by the docker compose build configuration without an extra layer of coordination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants