Skip to content

Commit 29f5eb7

Browse files
committed
Fix: Always build on build platform.
1 parent 085746e commit 29f5eb7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

postfix-exporter-01.patch

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ index 75a22d8..81145c9 100644
55
@@ -1,8 +1,41 @@
66
-FROM scratch
77
+# syntax=docker/dockerfile:1.2
8-
+FROM golang:1.23 AS builder
8+
+FROM --platform=$BUILDPLATFORM golang:1.23 AS builder
99
LABEL org.opencontainers.image.source="https://github.com/hsn723/postfix_exporter" \
1010
org.opencontainers.image.authors="Hsn723" \
1111
org.opencontainers.image.title="postfix_exporter"
@@ -38,6 +38,7 @@ index 75a22d8..81145c9 100644
3838
+# Since we are checking out a specific SHA hash and we know this tests have worked previously, we are quite certain that the code will work.
3939
+# Hence disabling the test here.
4040
+# RUN go test
41+
+RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM $TARGETOS/$TARGETARCH/$TARGETVARIANT"
4142
+RUN env GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" GOARM="$( echo "$TARGETVARIANT" | grep -E -o "\\d+$")" go build -ldflags '-extldflags "-static"' -o /bin/postfix_exporter
4243
+
4344
+FROM scratch

0 commit comments

Comments
 (0)