From a85b1abd37386286199faaebf610977bdebce741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Valais?= Date: Fri, 25 Feb 2022 16:34:06 +0100 Subject: [PATCH] make: work around the multiple copies of each binaries with hard links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maƫl Valais --- make/containers.mk | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/make/containers.mk b/make/containers.mk index 0c02b69e6..c7aa88b09 100644 --- a/make/containers.mk +++ b/make/containers.mk @@ -111,17 +111,22 @@ bin/containers: # each due to the copying happening. To avoid that, we set a different folder # for each "docker build" command, which reduces the copying to ~50 MB per # "docker build". +# +# Note that we can't use symlinks in the build context. In order to avoid the +# cost of multiple copies of the same binary, we use hard links which shouldn't +# be a problem since the bin/ folder is entirely managed by make. + $(foreach arch,$(ARCHS),$(foreach bin,$(BINS), bin/scratch/build-context/cert-manager-$(bin)-linux-$(arch))): @mkdir -p $@ bin/scratch/build-context/cert-manager-%/cert-manager.license: bin/scratch/cert-manager.license | bin/scratch/build-context/cert-manager-% - @cp $< $@ + @ln -f $< $@ bin/scratch/build-context/cert-manager-%/cert-manager.licenses_notice: bin/scratch/cert-manager.licenses_notice | bin/scratch/build-context/cert-manager-% - @cp $< $@ + @ln -f $< $@ bin/scratch/build-context/cert-manager-%/controller bin/scratch/build-context/cert-manager-%/acmesolver bin/scratch/build-context/cert-manager-%/cainjector bin/scratch/build-context/cert-manager-%/webhook: bin/server/% | bin/scratch/build-context/cert-manager-% - @cp $< $@ + @ln -f $< $@ bin/scratch/build-context/cert-manager-ctl-%/ctl: bin/cmctl/cmctl-% | bin/scratch/build-context/cert-manager-ctl-% - @cp $< $@ + @ln -f $< $@