From 7b25906ff7cc3e101655c419ca61d8ece8d8a8c3 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Fri, 1 May 2020 14:19:30 -0700 Subject: [PATCH 1/2] Build updates Move to go 1.14 Explicitly apt-get update when building --- Dockerfile.in | 1 + Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile.in b/Dockerfile.in index 59c2061..ed16d31 100644 --- a/Dockerfile.in +++ b/Dockerfile.in @@ -15,6 +15,7 @@ FROM {ARG_FROM} RUN apt-get update \ + && apt-get -y upgrade \ && apt-get -y install \ ca-certificates \ coreutils \ diff --git a/Makefile b/Makefile index 08d7209..9927285 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ BASEIMAGE ?= k8s.gcr.io/debian-base:v2.0.0 IMAGE := $(REGISTRY)/$(BIN) TAG := $(VERSION)__$(OS)_$(ARCH) -BUILD_IMAGE ?= golang:1.13-alpine +BUILD_IMAGE ?= golang:1.14-alpine # If you want to build all binaries, see the 'all-build' rule. # If you want to build all containers, see the 'all-container' rule. From 8f87fd8397fc1e665c98412d8b1b172268bb2462 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Fri, 4 Sep 2020 13:15:38 -0700 Subject: [PATCH 2/2] Fix multi-arch build support Buildx seems to do what we need. --- .gitignore | 1 + Makefile | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f0c128e..1cc7010 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /.push-* /.container-* /.dockerfile-* +/.qemu-initialized diff --git a/Makefile b/Makefile index 9927285..09390b9 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,9 @@ container: .container-$(DOTFILE_IMAGE) container-name -e 's|{ARG_OS}|$(OS)|g' \ -e 's|{ARG_FROM}|$(BASEIMAGE)|g' \ Dockerfile.in > .dockerfile-$(OS)_$(ARCH) - @docker build \ + @docker buildx build \ + --load \ + --platform "$(OS)/$(ARCH)" \ --build-arg HTTP_PROXY=$(HTTP_PROXY) \ --build-arg HTTPS_PROXY=$(HTTPS_PROXY) \ -t $(IMAGE):$(TAG) \ @@ -180,13 +182,26 @@ test: $(BUILD_DIRS) test-tools: @docker build -t $(REGISTRY)/test/test-sshd _test_tools/sshd +# Help set up multi-arch build tools. This assumes you have the tools +# installed. If you already have a buildx builder available, you don't need +# this. See https://medium.com/@artur.klauser/building-multi-architecture-docker-images-with-buildx-27d80f7e2408 +# for great context. +multiarch-build-tools: .qemu-initialized + @docker buildx create --name git-sync --node git-sync-0 + @docker buildx use git-sync + @docker buildx inspect --bootstrap + +.qemu-initialized: + @docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + @date > $@ + $(BUILD_DIRS): @mkdir -p $@ clean: container-clean bin-clean container-clean: - rm -rf .container-* .dockerfile-* .push-* + rm -rf .container-* .dockerfile-* .push-* .qemu-initialized bin-clean: rm -rf .go bin