From cd07ed644f67719c5d0a43636a84763ff4ce95d4 Mon Sep 17 00:00:00 2001 From: Maka0 Date: Mon, 15 Jun 2020 22:20:59 +0200 Subject: [PATCH] Updated Makefile to build multi-arch containers (#93) Co-authored-by: Maka0 --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d1e3518..e3a5cd5 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,14 @@ endif geoip-download: $(databases) +# Create an environment to build multiarch containers (https://github.com/docker/buildx/) +docker-multiarch-builder: + DOCKER_BUILDKIT=1 $(DOCKER) build -o . git://github.com/docker/buildx + mkdir -p ~/.docker/cli-plugins + mv buildx ~/.docker/cli-plugins/docker-buildx + $(DOCKER) buildx create --name multiarch-builder --node multiarch-builder --driver docker-container --use + $(DOCKER) run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker-build: $(DOCKER) build -t $(DOCKER_IMAGE) . @@ -46,8 +54,8 @@ docker-test: $(eval DOCKER_PORT=$(shell $(DOCKER) port $(CONTAINER) | cut -d ":" -f 2)) curl -fsS -m 5 localhost:$(DOCKER_PORT) > /dev/null; $(DOCKER) stop $(CONTAINER) -docker-push: docker-test docker-login - $(DOCKER) push $(DOCKER_IMAGE) +docker-push: docker-test docker-multiarch-builder docker-login + $(DOCKER) buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $(DOCKER_IMAGE) --push . heroku-run: geoip-download ifndef PORT