diff --git a/Dockerfile b/Dockerfile index e3c38f8bc7..92ad5b367b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM gcr.io/distroless/static:latest +ARG BASE_IMAGE=gcr.io/distroless/static:latest +FROM $BASE_IMAGE LABEL maintainers="Kubernetes Authors" LABEL description="CSI External Provisioner" diff --git a/release-tools/build.make b/release-tools/build.make index 1b6f35fe1c..3c06f513b8 100644 --- a/release-tools/build.make +++ b/release-tools/build.make @@ -62,6 +62,12 @@ endif ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) +# Specific BASE_IMAGE for different arch, default BASE_IMAGE gcr.io/distroless is for x86, discolix/static is for arm. +BASE_IMAGE=gcr.io/distroless/static:latest +ifeq (${ARCH}, arm64) + BASE_IMAGE=discolix/static:latest +endif + # Specific packages can be excluded from each of the tests below by setting the *_FILTER_CMD variables # to something like "| grep -v 'github.com/kubernetes-csi/project/pkg/foobar'". See usage below. @@ -73,7 +79,7 @@ build-%: check-go-version-go fi container-%: build-% - docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) . + docker build -t $*:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) --build-arg BASE_IMAGE=${BASE_IMAGE} . push-%: container-% set -ex; \