bake-action icon indicating copy to clipboard operation
bake-action copied to clipboard

Building on multiple native nodes

Open ndench opened this issue 3 years ago • 4 comments

This a great, github action. Makes it super easy to get all our required docker images built and published in CI.

Is it possible to support building across multiple native nodes? When building our images for both linux/arm64 and linux/amd64 using QEMU, the build takes 60 minutes in CI. By splitting the build to run on two separate native nodes the build time is reduced to 15 minutes.

The only problem with this approach is that both builds push their own manifest separately instead of a combined one at the end. So the latest pushed image only knows of a single platform.

ndench avatar Feb 07 '22 02:02 ndench

I started with the multi node approach, but then separated manifest is a no deal.

fzipi avatar Mar 27 '22 13:03 fzipi

I agree, it makes multi node builds unusable. I was hoping there's some way of building multiple nodes and generating the manifest at the end.

ndench avatar Mar 28 '22 00:03 ndench

🤔 Looks like this thecnique can be adapted for doing it.

fzipi avatar Mar 28 '22 10:03 fzipi

https://github.com/docker/setup-buildx-action/pull/165 could fix this. See https://github.com/crazy-max/docker-setup-buildx-action/blob/append/docs/advanced/append-nodes.md for more info.

Live example available: https://github.com/docker/packaging/blob/fe177e05bb5a23115813f1c476705c3ae7039c32/.github/workflows/.release.yml#L66-L87

crazy-max avatar Oct 03 '22 17:10 crazy-max

Is there a way to do this with bake-action now?

schmunk42 avatar Apr 13 '23 09:04 schmunk42

See https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners to distribute build across multiple runners. To use this example with bake you can look at https://github.com/crazy-max/docker-osxcross/pull/24

Best is ofc to use a builder with native nodes against the platform you want to build: https://docs.docker.com/build/ci/github-actions/configure-builder/#append-additional-nodes-to-the-builder. Example here: https://github.com/docker/packaging/blob/2c95ad0ca93ea91a01755b01e9a979adec955540/.github/workflows/.release.yml#L62-L89

crazy-max avatar Jun 09 '23 13:06 crazy-max