Skip to content

Update multi-platform.md #22286

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions content/manuals/build/ci/github-actions/multi-platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ jobs:
## Distribute build across multiple runners

In the previous example, each platform is built on the same runner which can
take a long time depending on the number of platforms and your Dockerfile.
take a long time depending on the number of platforms and your Dockerfile and
because emulating aarch64 (arm64) on x86_64 can take a long time.

To solve this issue you can use a matrix strategy to distribute the build for
each platform across multiple runners and create manifest list using the
[`buildx imagetools create` command](/reference/cli/docker/buildx/imagetools/create.md).

The following workflow will build the image for each platform on a dedicated
runner using a matrix strategy and push by digest. Then, the `merge` job will
runner (adapted to each platform) using a matrix strategy and push by digest. Then, the `merge` job will
create manifest lists and push them to Docker Hub. The [`metadata` action](https://github.com/docker/metadata-action)
is used to set tags and labels.

Expand All @@ -123,13 +124,16 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
os: [ubuntu-24.04, ubuntu-24.04-arm]
include:
- platform: linux/amd64
os: ubuntu-24.04
- platform: linux/arm64
os: ubuntu-24.04-arm
steps:
- name: Prepare
run: |
Expand Down Expand Up @@ -178,7 +182,7 @@ jobs:
retention-days: 1

merge:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs:
- build
steps:
Expand Down