Use docker buildx for etcd image

This allows to choose the correct architecture in the image manifest,
which defaulted to the host system before applying this patch.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
Sascha Grunert 2021-10-05 13:29:45 +02:00
parent 6f942a0701
commit 9ae990e3d5
No known key found for this signature in database
GPG Key ID: 09D97D153EF94D93
2 changed files with 12 additions and 2 deletions

View File

@ -34,7 +34,7 @@ LATEST_ETCD_VERSION?=3.5.0
# REVISION provides a version number for this image and all it's bundled
# artifacts. It should start at zero for each LATEST_ETCD_VERSION and increment
# for each revision of this image at that etcd version.
REVISION?=3
REVISION?=4
# IMAGE_TAG Uniquely identifies k8s.gcr.io/etcd docker image with a tag of the form "<etcd-version>-<revision>".
IMAGE_TAG=$(LATEST_ETCD_VERSION)-$(REVISION)
@ -84,6 +84,8 @@ endif
RUNNERIMAGE?=gcr.io/distroless/static:latest
QEMUVERSION?=5.2.0-2
build:
# Explicitly copy files to the temp directory
$(BIN_INSTALL) migrate-if-needed.sh $(TEMP_DIR)
@ -143,13 +145,20 @@ else
cd $(TEMP_DIR) && echo "ENV ETCD_UNSUPPORTED_ARCH=$(ARCH)" >> Dockerfile
endif
docker run --rm --privileged multiarch/qemu-user-static:$(QEMUVERSION) --reset -p yes
docker buildx version
BUILDER=$(shell docker buildx create --use)
# And build the image
docker build \
docker buildx build \
--pull \
--load \
--platform linux/$(ARCH) \
-t $(REGISTRY)/etcd-$(ARCH):$(IMAGE_TAG) \
--build-arg BASEIMAGE=$(BASEIMAGE) \
--build-arg RUNNERIMAGE=$(RUNNERIMAGE) \
$(TEMP_DIR)
docker buildx rm $$BUILDER
push: build
docker tag $(REGISTRY)/etcd-$(ARCH):$(IMAGE_TAG) $(MANIFEST_IMAGE)-$(ARCH):$(IMAGE_TAG)

View File

@ -14,6 +14,7 @@ steps:
- IMAGE=gcr.io/$PROJECT_ID/etcd
- BUILD_IMAGE=debian-build
- TMPDIR=/workspace
- HOME=/root # for docker buildx
args:
- '-c'
- |