containers / buildah

A tool that facilitates building OCI images.
https://buildah.io
Apache License 2.0
7.36k stars 779 forks source link

[RFE]: Add support for `buildx bake` command #4796

Open vially opened 1 year ago

vially commented 1 year ago

Docker supports higher-level builds using the buildx bake command. The command introduction page provides a good overview about the use-cases enabled by this command:

Buildx also aims to provide support for high-level build concepts that go beyond invoking a single build command. We want to support building all the images in your application together and let the users define project specific reusable build flows that can then be easily invoked by anyone.

BuildKit efficiently handles multiple concurrent build requests and de-duplicating work. The build commands can be combined with general-purpose command runners (for example, make). However, these tools generally invoke builds in sequence and therefore cannot leverage the full potential of BuildKit parallelization, or combine BuildKit’s output for the user. For this use case, we have added a command called docker buildx bake.

Personally, I'm mostly interested in this command because it allows getting rid of various hackish scripts and make files and replaces them with a single command: buildah builx bake.

That being said, the command is still experimental in Docker and has a pretty big API surface (lots of flags and config options) so it might not be trivial to support it in buildah. But I think even a simplified version of this command that only covers the basic stuff could still provide a lot of value to buildah/podman users.

rhatdan commented 1 year ago

Sure interested in opening some PRs to start building it.

github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 1 year ago

Can't resist a joke. But since Docker does not support this, does that mean it is half baked? :^)

github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 1 year ago

How does one specify what you want to bake? Multiple Containerfiles?

gedw99 commented 1 year ago

here is a good example of its usage: https://github.com/crazy-max/xgo#build

git clone https://github.com/crazy-max/xgo.git xgo
cd xgo

# Build xgo image and output to docker with xgo:local tag
docker buildx bake

# Tests
BASE_IMAGE=xgo:local docker buildx bake test-c
BASE_IMAGE=xgo:local docker buildx bake test-cpp
BASE_IMAGE=xgo:local docker buildx bake test-gorm

# Create xgo artifacts in ./dist
docker buildx bake artifact-all
rhatdan commented 1 year ago

@flouthoc PTAL

github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] commented 1 year ago

A friendly reminder that this issue had no activity for 30 days.

rhatdan commented 1 year ago

@umohnani8 We might want to look at something like this after podman farm build.

vrothberg commented 1 year ago

Wouldn't it make sense to point buildkit to the podman socket at some point? I fear it's not that sustainable to chase buildkit which is evolving very rapidly. Similar to podman compose, a hypothetical podman buildx would call buildkit but point it to the podman socket.

That would allow to focus on the REST API.

kmf commented 11 months ago

watching this.

github-actions[bot] commented 10 months ago

A friendly reminder that this issue had no activity for 30 days.

sword-jin commented 10 months ago

Great feature, we have a pipeline to build 20+ targets, it will help

github-actions[bot] commented 8 months ago

A friendly reminder that this issue had no activity for 30 days.

Cjewett commented 7 months ago

Also find this one valuable. We have functionality relying on docker buildx Bake and we'd like to move to Buildah and Podman but have been hesitant due to this lack of functionality.

igotinfected commented 1 month ago

Same use-case here, we use bake to build multiple targets that share the same image context concurrently, makes the pipeline command docker buildx bake rather than hundreds of lines of multiple docker builds and build args.