Skip to content

Commit 84b1586

Browse files
committed
automate multiarch build
1 parent d10affe commit 84b1586

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Push Multiarch Image to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write # Required for GHCR push
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
with:
25+
platforms: all
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Log in to GitHub Container Registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push multiarch image
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
platforms: linux/amd64,linux/arm/v7,linux/arm64
42+
push: ${{ github.event_name != 'pull_request' }} # Only push on push, not PR
43+
tags: |
44+
ghcr.io/${{ github.repository }}:latest
45+
ghcr.io/${{ github.repository }}:${{ github.sha }}

0 commit comments

Comments
 (0)