Skip to content

Commit 324de69

Browse files
hotfix: fix GoReleaser docker_v2 arm64 buildx exec format error
1 parent 64dab9d commit 324de69

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313

1414
permissions:
1515
contents: write
16+
packages: write
1617

1718
jobs:
1819
goreleaser:
@@ -23,6 +24,14 @@ jobs:
2324
with:
2425
fetch-depth: 0
2526
- run: git fetch --force --tags
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
with:
30+
platforms: arm64
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
with:
34+
driver: docker-container
2635
- name: Set up Go
2736
uses: actions/setup-go@v6
2837
with:
@@ -33,6 +42,12 @@ jobs:
3342
with:
3443
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
3544
passphrase: ${{ secrets.PASSPHRASE }}
45+
- name: Log in to GHCR
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
3651
- name: Run GoReleaser
3752
uses: goreleaser/goreleaser-action@v6
3853
with:

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
FROM golang:1.25-alpine3.21 as builder
2-
RUN apk update && apk upgrade --available && sync
1+
FROM --platform=$BUILDPLATFORM golang:1.25-alpine3.21 AS builder
2+
ARG TARGETOS
3+
ARG TARGETARCH
34
WORKDIR /app
45
COPY . .
5-
RUN CGO_ENABLED=0 go build -o /app/fsb -ldflags="-w -s" ./cmd/fsb
6+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /app/fsb -ldflags="-w -s" ./cmd/fsb
67

78
FROM scratch
89
COPY --from=builder /app/fsb /app/fsb

0 commit comments

Comments
 (0)