build: using targetarch for arm support

This commit is contained in:
ptx96
2021-06-04 16:17:36 +02:00
committed by Dario Tranchitella
parent 7c1592e739
commit 20aa7657e4

View File

@@ -1,6 +1,7 @@
# Build the manager binary
FROM quay.io/bitnami/golang:1.16 as builder
FROM golang:1.16 as builder
ARG TARGETARCH
ARG GIT_HEAD_COMMIT
ARG GIT_TAG_COMMIT
ARG GIT_LAST_TAG
@@ -24,7 +25,7 @@ COPY controllers/ controllers/
COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH GO111MODULE=on go build \
-gcflags "-N -l" \
-ldflags "-X main.GitRepo=$GIT_REPO -X main.GitTag=$GIT_LAST_TAG -X main.GitCommit=$GIT_HEAD_COMMIT -X main.GitDirty=$GIT_MODIFIED -X main.BuildTime=$BUILD_DATE" \
-o manager