Skip to content

Commit 918d855

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

File tree

2 files changed

+67
-7
lines changed

2 files changed

+67
-7
lines changed

.github/workflows/docker.yml .github/workflows/docker-amd.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create and publish a Docker image
1+
name: AMD Docker image
22
on:
33
workflow_run:
44
workflows: [ "Rust" ]
@@ -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

@@ -26,27 +26,28 @@ jobs:
2626
uses: actions/checkout@v4
2727

2828
- name: Log in to the Container registry
29-
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99
29+
uses: docker/login-action@v3
3030
with:
3131
registry: ${{ env.REGISTRY }}
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
3434

3535
- name: Extract metadata (tags, labels) for Docker
3636
id: meta
37-
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
37+
uses: docker/metadata-action@v5
3838
with:
3939
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4040

41-
- name: Sync theme submodule
42-
run: git submodule sync && git submodule update --init --recursive
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
4343

4444
- name: Build and push Docker image
4545
id: push
46-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
46+
uses: docker/build-push-action@v6
4747
with:
4848
context: .
4949
push: true
50+
platforms: ${{ matrix.platform }}
5051
tags: ${{ steps.meta.outputs.tags }}
5152
labels: ${{ steps.meta.outputs.labels }}
5253

.github/workflows/docker-arm.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: ARM Docker image
2+
on:
3+
workflow_run:
4+
workflows: [ "Rust" ]
5+
branches: [ "main" ]
6+
types:
7+
- completed
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-24.04-arm
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Build and push Docker image
45+
id: push
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
push: true
50+
platforms: ${{ matrix.platform }}
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
54+
- name: Generate artifact attestation
55+
uses: actions/attest-build-provenance@v2
56+
with:
57+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
58+
subject-digest: ${{ steps.push.outputs.digest }}
59+
push-to-registry: true

0 commit comments

Comments
 (0)