Skip to content

Commit 2d57b5e

Browse files
committed
build arm container images on arm host
1 parent 1510710 commit 2d57b5e

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,45 @@ env:
77
IMAGE_NAME: ${{ github.repository }}
88

99
jobs:
10-
build:
11-
runs-on: ubuntu-latest
10+
build-x86:
11+
runs-on: ubuntu-24.04
1212
strategy:
1313
matrix:
14-
tag: [alpine-amd64, alpine-arm64, alpine-i386, linux-amd64, linux-arm64, linux-i386]
14+
tag: [alpine-amd64, alpine-i386, linux-amd64, linux-i386]
15+
permissions:
16+
contents: read
17+
packages: write
18+
id-token: write
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
- name: Log into registry ${{ env.REGISTRY }}
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Extract Docker metadata
31+
id: meta
32+
uses: docker/metadata-action@v5
33+
with:
34+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
35+
- name: Build and push Docker image
36+
id: build-and-push
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: "{{defaultContext}}:${{ matrix.tag }}"
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
41+
labels: ${{ steps.meta.outputs.labels }}
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max
44+
build-arm:
45+
runs-on: ubuntu-24.04-arm
46+
strategy:
47+
matrix:
48+
tag: [alpine-arm64, linux-arm64]
1549
permissions:
1650
contents: read
1751
packages: write

0 commit comments

Comments
 (0)