Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #394: Set GOARCH through TARGETPLATFORM to correctly build for ARM machines. #395

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ all: driver sidecar-mounter webhook metadata-prefetch

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

metadata-prefetch:
mkdir -p ${BINDIR}
CGO_ENABLED=0 GOOS=linux GOARCH=$(shell dpkg --print-architecture) go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${PREFETCH_BINARY} cmd/metadata_prefetch/main.go
CGO_ENABLED=0 GOOS=linux go build -mod vendor -ldflags "${LDFLAGS}" -o ${BINDIR}/${PREFETCH_BINARY} cmd/metadata_prefetch/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
Expand Down
3 changes: 2 additions & 1 deletion cmd/csi_driver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
FROM --platform=$BUILDPLATFORM golang:1.23.3 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
Expand Down
3 changes: 2 additions & 1 deletion cmd/metadata_prefetch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
FROM --platform=$BUILDPLATFORM golang:1.23.3 AS metadata-prefetch-builder

ARG STAGINGVERSION
ARG TARGETPLATFORM

WORKDIR /gcs-fuse-csi-driver
ADD . .
RUN make metadata-prefetch BINDIR=/bin
RUN GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') make metadata-prefetch BINDIR=/bin

# go/gke-releasing-policies#base-images
FROM gke.gcr.io/debian-base:bookworm-v1.0.4-gke.2 AS debian
Expand Down
3 changes: 2 additions & 1 deletion cmd/sidecar_mounter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
FROM --platform=$BUILDPLATFORM golang:1.23.3 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.
Expand Down
3 changes: 2 additions & 1 deletion cmd/webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
FROM --platform=$BUILDPLATFORM golang:1.23.3 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

Expand Down