File tree 1 file changed +11
-7
lines changed
content/manuals/build/ci/github-actions
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,15 @@ jobs:
101
101
# # Distribute build across multiple runners
102
102
103
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.
104
+ take a long time depending on the number of platforms and your Dockerfile and
105
+ because emulating aarch64 (arm64) on x86_64 can take a long time.
105
106
106
107
To solve this issue you can use a matrix strategy to distribute the build for
107
108
each platform across multiple runners and create manifest list using the
108
109
[`buildx imagetools create` command](/reference/cli/docker/buildx/imagetools/create.md).
109
110
110
111
The following workflow will build the image for each platform on a dedicated
111
- runner using a matrix strategy and push by digest. Then, the `merge` job will
112
+ runner (adapted to each platform) using a matrix strategy and push by digest. Then, the `merge` job will
112
113
create manifest lists and push them to Docker Hub. The [`metadata` action](https://github.com/docker/metadata-action)
113
114
is used to set tags and labels.
114
115
@@ -123,13 +124,16 @@ env:
123
124
124
125
jobs:
125
126
build:
126
- runs-on: ubuntu-latest
127
+ runs-on: ${{ matrix.os }}
127
128
strategy:
128
129
fail-fast: false
129
130
matrix:
130
- platform:
131
- - linux/amd64
132
- - linux/arm64
131
+ os: [ubuntu-24.04, ubuntu-24.04-arm]
132
+ include:
133
+ - platform: linux/amd64
134
+ os: ubuntu-24.04
135
+ - platform: linux/arm64
136
+ os: ubuntu-24.04-arm
133
137
steps:
134
138
- name: Prepare
135
139
run: |
@@ -178,7 +182,7 @@ jobs:
178
182
retention-days: 1
179
183
180
184
merge:
181
- runs-on: ubuntu-latest
185
+ runs-on: ubuntu-24.04
182
186
needs:
183
187
- build
184
188
steps:
You can’t perform that action at this time.
0 commit comments