Skip to content

Commit edf6685

Browse files
committed
chore: cross-compile Go binary for docker image to speed up CI
1 parent ce484ce commit edf6685

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.github/workflows/test-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
type=semver,pattern={{version}}
6262
type=raw,value=latest
6363
64-
- name: Build and push
64+
- name: Build and push Docker image (tagged and latest) to GitHub Container Registry
6565
if: ${{ startsWith(github.ref, 'refs/tags/') }}
6666
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
6767
with:

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG ALPINE_VERSION=3.22.0
22

3-
FROM golang:1.24-alpine AS builder
3+
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
44

55
WORKDIR /build
66

@@ -9,7 +9,7 @@ COPY go.mod go.sum ./
99
RUN go mod download && go mod verify
1010

1111
COPY . .
12-
RUN go build -o unregistry ./cmd/unregistry
12+
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o unregistry ./cmd/unregistry
1313

1414

1515
# Unregistry in Docker-in-Docker image for e2e tests.

0 commit comments

Comments
 (0)