Skip to content

Commit 04f3442

Browse files
ci: add workflow to build and publish container image on GHCR (#20)
Signed-off-by: Jan Larwig <jan.larwig@digits.schwarz> Co-authored-by: Jan Larwig <jan.larwig@digits.schwarz>
1 parent b2def35 commit 04f3442

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build container image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v5
17+
18+
- uses: docker/setup-buildx-action@v3
19+
20+
- uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: ghcr.io/${{ github.repository }}
30+
tags: |
31+
type=ref,event=branch
32+
type=semver,pattern={{version}}
33+
type=sha
34+
35+
- uses: docker/build-push-action@v6
36+
with:
37+
context: .
38+
platforms: linux/amd64,linux/arm64
39+
push: true
40+
tags: ${{ steps.meta.outputs.tags }}
41+
labels: ${{ steps.meta.outputs.labels }}
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.26 AS builder
2+
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

0 commit comments

Comments
 (0)