Skip to content

Commit e7df11f

Browse files
committed
build multi-platform docker images
1 parent feb7ad8 commit e7df11f

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

.github/workflows/docker.yml

+21-13
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,50 @@ env:
1111
IMAGE_NAME: ${{ github.repository }}
1212

1313
jobs:
14-
build-and-push-image:
14+
build:
1515
runs-on: ubuntu-latest
1616
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17-
18-
permissions:
19-
contents: read
20-
packages: write
21-
attestations: write
22-
id-token: write
23-
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
platform:
21+
- linux/amd64
22+
- linux/arm64
2423
steps:
2524
- name: Checkout repository
2625
uses: actions/checkout@v4
2726

27+
- name: Prepare
28+
run: |
29+
platform=${{ matrix.platform }}
30+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
31+
2832
- name: Log in to the Container registry
29-
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99
33+
uses: docker/login-action@v3
3034
with:
3135
registry: ${{ env.REGISTRY }}
3236
username: ${{ github.actor }}
3337
password: ${{ secrets.GITHUB_TOKEN }}
3438

3539
- name: Extract metadata (tags, labels) for Docker
3640
id: meta
37-
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
41+
uses: docker/metadata-action@v5
3842
with:
3943
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4044

41-
- name: Sync theme submodule
42-
run: git submodule sync && git submodule update --init --recursive
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v3
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@v3
4350

4451
- name: Build and push Docker image
4552
id: push
46-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
53+
uses: docker/build-push-action@v6
4754
with:
4855
context: .
4956
push: true
57+
platforms: ${{ matrix.platform }}
5058
tags: ${{ steps.meta.outputs.tags }}
5159
labels: ${{ steps.meta.outputs.labels }}
5260

0 commit comments

Comments
 (0)