Skip to content

Commit 147a31d

Browse files
committed
build: use arm-native gha runners for distributed multi-platform
Signed-off-by: David Karlsson <[email protected]>
1 parent 962c42c commit 147a31d

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

content/manuals/build/ci/github-actions/multi-platform.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ jobs:
100100

101101
## Distribute build across multiple runners
102102

103-
In the previous example, each platform is built on the same runner which can
104-
take a long time depending on the number of platforms and your Dockerfile.
105-
106-
To solve this issue you can use a matrix strategy to distribute the build for
107-
each platform across multiple runners and create manifest list using the
103+
Building multiple platforms on the same runner can significantly extend build
104+
times, particularly when dealing with complex Dockerfiles or a high number of
105+
target platforms. By distributing platform-specific builds across multiple
106+
runners using a matrix strategy, you can drastically reduce build durations and
107+
streamline your CI pipeline. These examples demonstrate how to allocate each
108+
platform build to a dedicated runner, including ARM-native runners where
109+
applicable, and create a unified manifest list using the
108110
[`buildx imagetools create` command](/reference/cli/docker/buildx/imagetools/create.md).
109111

110112
The following workflow will build the image for each platform on a dedicated
@@ -123,13 +125,15 @@ env:
123125
124126
jobs:
125127
build:
126-
runs-on: ubuntu-latest
127128
strategy:
128129
fail-fast: false
129130
matrix:
130-
platform:
131-
- linux/amd64
132-
- linux/arm64
131+
include:
132+
- platform: linux/amd64
133+
runner: ubuntu-latest
134+
- platform: linux/arm64
135+
runner: ubuntu-24.04-arm
136+
runs-on: ${{ matrix.runner }}
133137
steps:
134138
- name: Prepare
135139
run: |
@@ -311,13 +315,13 @@ jobs:
311315
retention-days: 1
312316
313317
build:
314-
runs-on: ubuntu-latest
315318
needs:
316319
- prepare
317320
strategy:
318321
fail-fast: false
319322
matrix:
320323
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
324+
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
321325
steps:
322326
- name: Prepare
323327
run: |
@@ -329,16 +333,13 @@ jobs:
329333
with:
330334
name: bake-meta
331335
path: ${{ runner.temp }}
332-
336+
333337
- name: Login to Docker Hub
334338
uses: docker/login-action@v3
335339
with:
336340
username: ${{ vars.DOCKERHUB_USERNAME }}
337341
password: ${{ secrets.DOCKERHUB_TOKEN }}
338342
339-
- name: Set up QEMU
340-
uses: docker/setup-qemu-action@v3
341-
342343
- name: Set up Docker Buildx
343344
uses: docker/setup-buildx-action@v3
344345

0 commit comments

Comments
 (0)