Skip to content

Commit c72f084

Browse files
authored
Merge pull request #21369 from dvdksn/gha-setup-docker-example
build: gha example loading multi-platform images with containerd
2 parents 9eeb171 + 7402de4 commit c72f084

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,59 @@ jobs:
4545
tags: user/app:latest
4646
```
4747
48+
## Build and load multi-platform images
49+
50+
The default Docker setup for GitHub Actions runners does not support loading
51+
multi-platform images to the local image store of the runner after building
52+
them. To load a multi-platform image, you need to enable the containerd image
53+
store option for the Docker Engine.
54+
55+
There is no way to configure the default Docker setup in the GitHub Actions
56+
runners directly, but you can use the `crazy-max/ghaction-setup-docker` action
57+
to customize the Docker Engine and CLI settings for a job.
58+
59+
The following example workflow enables the containerd image store, builds a
60+
multi-platform image, and loads the results into the GitHub runner's local
61+
image store.
62+
63+
```yaml
64+
name: ci
65+
66+
on:
67+
push:
68+
69+
jobs:
70+
docker:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Set up Docker
74+
uses: crazy-max/ghaction-setup-docker@v3
75+
with:
76+
daemon-config: |
77+
{
78+
"debug": true,
79+
"features": {
80+
"containerd-snapshotter": true
81+
}
82+
}
83+
84+
- name: Set up QEMU
85+
uses: docker/setup-qemu-action@v3
86+
87+
- name: Login to Docker Hub
88+
uses: docker/login-action@v3
89+
with:
90+
username: ${{ vars.DOCKERHUB_USERNAME }}
91+
password: ${{ secrets.DOCKERHUB_TOKEN }}
92+
93+
- name: Build and push
94+
uses: docker/build-push-action@v6
95+
with:
96+
platforms: linux/amd64,linux/arm64
97+
load: true
98+
tags: user/app:latest
99+
```
100+
48101
## Distribute build across multiple runners
49102

50103
In the previous example, each platform is built on the same runner which can

0 commit comments

Comments
 (0)