Skip to content

Build multi-arch images for ARM64 and AMD64 at the same time #741

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

Merged
merged 1 commit into from
Apr 15, 2021
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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
FROM golang:1.13.15 as builder
WORKDIR /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
ADD . .
RUN make
RUN make gce-pd-driver

# MAD HACKS: Build a version first so we can take the scsi_id bin and put it somewhere else in our real build
FROM k8s.gcr.io/build-image/debian-base-amd64:v2.1.3 as base
FROM k8s.gcr.io/build-image/debian-base:v2.1.3 as base
RUN clean-install udev

# Start from Kubernetes Debian base
FROM k8s.gcr.io/build-image/debian-base-amd64:v2.1.3
FROM k8s.gcr.io/build-image/debian-base:v2.1.3
COPY --from=builder /go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /gce-pd-csi-driver
# Install necessary dependencies
RUN clean-install util-linux e2fsprogs mount ca-certificates udev xfsprogs
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ push-container: build-container
gcloud docker -- push $(STAGINGIMAGE):$(STAGINGVERSION)

build-and-push-container-linux: require-GCE_PD_CSI_STAGING_IMAGE init-buildx
$(DOCKER) buildx build --platform=linux \
$(DOCKER) buildx build --platform=linux/amd64,linux/arm64 \
-t $(STAGINGIMAGE):$(STAGINGVERSION)_linux \
--build-arg TAG=$(STAGINGVERSION) --push .

Expand All @@ -97,8 +97,8 @@ endif

init-buildx:
# Ensure we use a builder that can leverage it (the default on linux will not)
-$(DOCKER) buildx rm windows-builder
$(DOCKER) buildx create --use --name=windows-builder
-$(DOCKER) buildx rm multiarch-multiplatform-builder
$(DOCKER) buildx create --use --name=multiarch-multiplatform-builder
# Register gcloud as a Docker credential helper.
# Required for "docker buildx build --push".
gcloud auth configure-docker --quiet