Skip to content

Commit 1505251

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

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/docker.yml

+22-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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' }}
1717

@@ -21,32 +21,48 @@ jobs:
2121
attestations: write
2222
id-token: write
2323

24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
platform:
28+
- linux/amd64
29+
- linux/arm64
30+
2431
steps:
2532
- name: Checkout repository
2633
uses: actions/checkout@v4
2734

35+
- name: Prepare
36+
run: |
37+
platform=${{ matrix.platform }}
38+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
39+
2840
- name: Log in to the Container registry
29-
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99
41+
uses: docker/login-action@v3
3042
with:
3143
registry: ${{ env.REGISTRY }}
3244
username: ${{ github.actor }}
3345
password: ${{ secrets.GITHUB_TOKEN }}
3446

3547
- name: Extract metadata (tags, labels) for Docker
3648
id: meta
37-
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
49+
uses: docker/metadata-action@v5
3850
with:
3951
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4052

41-
- name: Sync theme submodule
42-
run: git submodule sync && git submodule update --init --recursive
53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v3
55+
56+
- name: Set up Docker Buildx
57+
uses: docker/setup-buildx-action@v3
4358

4459
- name: Build and push Docker image
4560
id: push
46-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
61+
uses: docker/build-push-action@v6
4762
with:
4863
context: .
4964
push: true
65+
platforms: ${{ matrix.platform }}
5066
tags: ${{ steps.meta.outputs.tags }}
5167
labels: ${{ steps.meta.outputs.labels }}
5268

0 commit comments

Comments
 (0)