From 5c1ecc1c7169f698b09e3a865f17f2c00a1e53c0 Mon Sep 17 00:00:00 2001 From: Megha-Rajanna <62827113+Megha-Rajanna@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:40:00 +0530 Subject: [PATCH] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b5813dd1..121aa265 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ ARG DOCKER_REGISTRY ARG DISTROLESS_DOCKER_REGISTRY ARG ALPINE_VERSION=3.18 +ARG TARGETARCH FROM ${DOCKER_REGISTRY:+$DOCKER_REGISTRY/}golang:1.21-alpine${ALPINE_VERSION} as go-builder ARG PROJECT_NAME=zookeeper-operator @@ -26,7 +27,7 @@ COPY api/ api/ COPY controllers/ controllers/ # Build -RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ +RUN GOOS=linux GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o /src/${PROJECT_NAME} \ -ldflags "-X ${REPO_PATH}/pkg/version.Version=${VERSION} -X ${REPO_PATH}/pkg/version.GitSHA=${GIT_SHA}" main.go FROM ${DISTROLESS_DOCKER_REGISTRY:-gcr.io/}distroless/static-debian11:nonroot AS final