diff --git a/build/debian-hyperkube-base/Makefile b/build/debian-hyperkube-base/Makefile index f47d8caa6d2..30b12386a3e 100644 --- a/build/debian-hyperkube-base/Makefile +++ b/build/debian-hyperkube-base/Makefile @@ -51,8 +51,10 @@ endif mkdir -p ${TEMP_DIR}/cni-bin/bin tar -xz -C ${TEMP_DIR}/cni-bin/bin -f "cni-tars/${CNI_TARBALL}" +ifneq ($(ARCH),amd64) # Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel docker run --rm --privileged multiarch/qemu-user-static:register --reset +endif docker build --pull -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR) rm -rf $(TEMP_DIR) diff --git a/build/debian-iptables/Dockerfile b/build/debian-iptables/Dockerfile index 0ec3d56dc62..e4fd481fbb4 100644 --- a/build/debian-iptables/Dockerfile +++ b/build/debian-iptables/Dockerfile @@ -14,10 +14,6 @@ FROM BASEIMAGE -# If we're building for another architecture than amd64, the CROSS_BUILD_ placeholder is removed so e.g. CROSS_BUILD_COPY turns into COPY -# If we're building normally, for amd64, CROSS_BUILD lines are removed -CROSS_BUILD_COPY qemu-ARCH-static /usr/bin/ - RUN clean-install \ conntrack \ ebtables \ diff --git a/build/debian-iptables/Makefile b/build/debian-iptables/Makefile index d70a4fce8bf..8cd9ccb4d4c 100644 --- a/build/debian-iptables/Makefile +++ b/build/debian-iptables/Makefile @@ -19,37 +19,16 @@ IMAGE=debian-iptables TAG=v10.1 ARCH?=amd64 TEMP_DIR:=$(shell mktemp -d) -QEMUVERSION=v2.9.1 - -ifeq ($(ARCH),arm) - QEMUARCH=arm -endif -ifeq ($(ARCH),arm64) - QEMUARCH=aarch64 -endif -ifeq ($(ARCH),ppc64le) - QEMUARCH=ppc64le -endif -ifeq ($(ARCH),s390x) - QEMUARCH=s390x -endif BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.3.1 build: cp ./* $(TEMP_DIR) cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile - cd $(TEMP_DIR) && sed -i "s|ARCH|$(QEMUARCH)|g" Dockerfile -ifeq ($(ARCH),amd64) - # When building "normally" for amd64, remove the whole line, it has no part in the amd64 image - cd $(TEMP_DIR) && sed -i "/CROSS_BUILD_/d" Dockerfile -else - # When cross-building, only the placeholder "CROSS_BUILD_" should be removed - # Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel +ifneq ($(ARCH),amd64) + # Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel docker run --rm --privileged multiarch/qemu-user-static:register --reset - curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR) - cd $(TEMP_DIR) && sed -i "s/CROSS_BUILD_//g" Dockerfile endif docker build --pull -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR) diff --git a/cluster/images/hyperkube/Makefile b/cluster/images/hyperkube/Makefile index 4c8a645d92a..3d0a6f5d0fe 100644 --- a/cluster/images/hyperkube/Makefile +++ b/cluster/images/hyperkube/Makefile @@ -39,8 +39,10 @@ endif cd ${TEMP_DIR} && sed -i.back "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile +ifneq ($(ARCH),amd64) # Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel docker run --rm --privileged multiarch/qemu-user-static:register --reset +endif docker build --pull -t ${REGISTRY}/hyperkube-${ARCH}:${VERSION} ${TEMP_DIR} rm -rf "${TEMP_DIR}"