Skip to content

Commit 9a1e5c9

Browse files
committed
ci: use native arm64 runner and cache build layers
1 parent 4d1d791 commit 9a1e5c9

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

.github/workflows/docker-build.yml

+45-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker build and push
1+
name: Docker
22

33
on:
44
pull_request:
@@ -15,7 +15,50 @@ env:
1515
IMAGE_NAME: ${{ github.repository }}
1616

1717
jobs:
18-
docker-build-and-push:
18+
build:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
platform:
24+
- linux/amd64
25+
- linux/arm64
26+
27+
permissions:
28+
contents: read
29+
packages: write
30+
attestations: write
31+
id-token: write
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Build and cache Docker image
51+
id: push
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
platforms: ${{ matrix.platform }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
push: false
59+
60+
push:
61+
needs: build
1962
runs-on: ubuntu-latest
2063

2164
permissions:

0 commit comments

Comments
 (0)