From ab6bef3816a617808f444e8f35094348ef013732 Mon Sep 17 00:00:00 2001 From: Artem Barger Date: Tue, 31 Oct 2023 13:25:47 +0200 Subject: [PATCH] Switching to use buildx to build docker images This commit enables to use `docker buildx` and make use of remote cache while building new images, to reuse unchanged layers instead of building them each time, thus speeding up building new Fabric container images. Signed-off-by: Artem Barger --- Makefile | 2 ++ docker-env.mk | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cb0a082c448..13f8c3f9dcd 100644 --- a/Makefile +++ b/Makefile @@ -249,6 +249,8 @@ $(BUILD_DIR)/images/%/$(DUMMY): --build-arg TARGETARCH=$(ARCH) \ --build-arg TARGETOS=linux \ $(BUILD_ARGS) \ + --cache-to type=inline,mode=max \ + --cache-from type=registry,ref=$(DOCKER_NS)/fabric-$*:$(FABRIC_VER) \ -t $(DOCKER_NS)/fabric-$* \ -t $(DOCKER_NS)/fabric-$*:$(FABRIC_VER) \ -t $(DOCKER_NS)/fabric-$*:$(TWO_DIGIT_VERSION) \ diff --git a/docker-env.mk b/docker-env.mk index 50c2d15ae3c..68aa4efde14 100644 --- a/docker-env.mk +++ b/docker-env.mk @@ -21,7 +21,7 @@ ifneq ($(NO_PROXY),) DOCKER_BUILD_FLAGS+=--build-arg 'NO_PROXY=$(NO_PROXY)' endif -DOCKER_BUILD ?= docker build --force-rm +DOCKER_BUILD ?= docker buildx build --force-rm DBUILD = $(DOCKER_BUILD) $(DOCKER_BUILD_FLAGS) DOCKER_NS ?= hyperledger