diff --git a/Makefile b/Makefile index cdb559fd..6c117745 100755 --- a/Makefile +++ b/Makefile @@ -50,15 +50,15 @@ all: driver sidecar-mounter webhook driver: mkdir -p ${BINDIR} - CGO_ENABLED=0 GOOS=linux GOARCH=$(shell dpkg --print-architecture) go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${DRIVER_BINARY} cmd/csi_driver/main.go + CGO_ENABLED=0 GOOS=linux go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${DRIVER_BINARY} cmd/csi_driver/main.go sidecar-mounter: mkdir -p ${BINDIR} - CGO_ENABLED=0 GOOS=linux GOARCH=$(shell dpkg --print-architecture) go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${SIDECAR_BINARY} cmd/sidecar_mounter/main.go + CGO_ENABLED=0 GOOS=linux go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${SIDECAR_BINARY} cmd/sidecar_mounter/main.go webhook: mkdir -p ${BINDIR} - CGO_ENABLED=0 GOOS=linux GOARCH=$(shell dpkg --print-architecture) go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${WEBHOOK_BINARY} cmd/webhook/main.go + CGO_ENABLED=0 GOOS=linux go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${WEBHOOK_BINARY} cmd/webhook/main.go download-gcsfuse: mkdir -p ${BINDIR}/linux/amd64 ${BINDIR}/linux/arm64 diff --git a/cmd/csi_driver/Dockerfile b/cmd/csi_driver/Dockerfile index 062fd870..dd670ee2 100644 --- a/cmd/csi_driver/Dockerfile +++ b/cmd/csi_driver/Dockerfile @@ -17,10 +17,11 @@ FROM --platform=$BUILDPLATFORM golang:1.22.7 AS driver-builder ARG STAGINGVERSION +ARG TARGETPLATFORM WORKDIR /gcs-fuse-csi-driver ADD . . -RUN make driver BINDIR=/bin +RUN GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') make driver BINDIR=/bin # Start from Kubernetes Debian base. FROM gke.gcr.io/debian-base:bookworm-v1.0.2-gke.2 AS debian diff --git a/cmd/sidecar_mounter/Dockerfile b/cmd/sidecar_mounter/Dockerfile index 37769cbb..1030ba7a 100644 --- a/cmd/sidecar_mounter/Dockerfile +++ b/cmd/sidecar_mounter/Dockerfile @@ -17,10 +17,11 @@ FROM --platform=$BUILDPLATFORM golang:1.22.7 AS sidecar-mounter-builder ARG STAGINGVERSION +ARG TARGETPLATFORM WORKDIR /gcs-fuse-csi-driver ADD . . -RUN make sidecar-mounter BINDIR=/bin +RUN GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') make sidecar-mounter BINDIR=/bin # go/gke-releasing-policies#base-images # We use `gcr.io/distroless/base` because it includes glibc. diff --git a/cmd/webhook/Dockerfile b/cmd/webhook/Dockerfile index 564d3034..c5300804 100644 --- a/cmd/webhook/Dockerfile +++ b/cmd/webhook/Dockerfile @@ -17,10 +17,11 @@ FROM --platform=$BUILDPLATFORM golang:1.22.7 AS webhook-builder ARG STAGINGVERSION +ARG TARGETPLATFORM WORKDIR /gcs-fuse-csi-driver ADD . . -RUN make webhook BINDIR=/bin +RUN GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') make webhook BINDIR=/bin FROM gcr.io/distroless/static