From b65aedd49410fd5c90dc4b6ea5c9ad628d00c8de Mon Sep 17 00:00:00 2001 From: wangzihao Date: Tue, 31 Dec 2019 09:40:50 +0800 Subject: [PATCH] Support make container on arm64 architecture - judge the arch in build.make, set BASE_IMAGE to discolix/static:latest when ARCH is arm64. Signed-off-by: wangzihao --- build.make | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.make b/build.make index a9b9d25d..e83a2e78 100644 --- a/build.make +++ b/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. @@ -74,7 +80,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; \