@@ -102,9 +102,29 @@ SWARM_HOSTS = $(shell docker node ls --format="{{.Hostname}}" 2>$(if $(IS_WIN),N
102102
103103.PHONY : build build-nc rebuild build-devel build-devel-nc
104104
105+ # docker buildx cache location
106+ DOCKER_BUILDX_CACHE_FROM ?= /tmp/.buildx-cache
107+ DOCKER_BUILDX_CACHE_TO ?= /tmp/.buildx-cache
108+ DOCKER_TARGET_PLATFORMS ?= linux/amd64
109+ comma := ,
110+
105111define _docker_compose_build
106112export BUILD_TARGET =$(if $(findstring -devel,$@ ) ,development,production) ;\
107- pushd services && docker buildx bake --file docker-compose-build.yml $(if $(target ) ,$(target ) ,) && popd;
113+ pushd services &&\
114+ $(foreach service, $(SERVICES_LIST ) ,\
115+ $(if $(push ) ,\
116+ export $(subst -,_,$(shell echo $(service ) | tr a-z A-Z) ) _VERSION=$(shell cat services/$(service ) /VERSION) ;\
117+ ,) \
118+ ) \
119+ docker buildx bake \
120+ $(if $(findstring -devel,$@ ) ,,\
121+ --set * .platform=$(DOCKER_TARGET_PLATFORMS ) \
122+ ) \
123+ $(if $(findstring $(comma ) ,$(DOCKER_TARGET_PLATFORMS ) ) ,,--set * .output="type=docker$(comma ) push=false") \
124+ $(if $(push ) ,--push,) \
125+ $(if $(push ) ,--file docker-bake.hcl,) --file docker-compose-build.yml $(if $(target ) ,$(target ) ,) \
126+ $(if $(findstring -nc,$@ ) ,--no-cache,) &&\
127+ popd;
108128endef
109129
110130rebuild : build-nc # alias
@@ -518,7 +538,7 @@ info: ## displays setup information
518538
519539define show-meta
520540 $(foreach iid,$(shell docker images * /$(1 ) :* -q | sort | uniq) ,\
521- docker image inspect $(iid ) | jq '.[0] | .RepoTags, .ContainerConfig .Labels';)
541+ docker image inspect $(iid ) | jq '.[0] | .RepoTags, .Config .Labels, .Architecture ';)
522542endef
523543
524544info-images : # # lists tags and labels of built images. To display one: 'make target=webserver info-images'
0 commit comments