@@ -14,10 +14,13 @@ version = $(shell cat images/$(1)/version)
14
14
15
15
BASE_IMAGE := ${IMAGE}/base:${PYTHON_PACKAGE_VERSION}-$(call version,base)
16
16
17
+ BASE_CACHE_IMAGE := ${IMAGE}/base:cache
18
+
17
19
$(info Base image = ${BASE_IMAGE})
18
20
19
21
sub_tag = $(1 ) :${PYTHON_PACKAGE_VERSION}-$(call version,base) -$(call version,$(1 ) )
20
22
sub_image = ${IMAGE}/$(call sub_tag,$(1 ) )
23
+ sub_cache_image = ${IMAGE}/$(1 ) :cache
21
24
22
25
WORKFLOW_VERSION := $(shell cat argo/version)
23
26
$(info Workflow version = ${WORKFLOW_VERSION})
@@ -120,11 +123,12 @@ define JQ_DOCKER_BAKE
120
123
{
121
124
"base-base": {
122
125
dockerfile: "Dockerfile",
123
- "cache-to": ["type=local,dest=./cache"]
124
126
},
125
127
base: {
126
128
context: "images/base",
127
129
inherits: ["base-base"],
130
+ "cache-to": ["type=registry,ref=${BASE_CACHE_IMAGE},mode=max"],
131
+ "cache-from": ["type=registry,ref=${BASE_CACHE_IMAGE}"],
128
132
args: {
129
133
PYTHON_PACKAGE_VERSION: "${PYTHON_PACKAGE_VERSION}"
130
134
},
@@ -143,6 +147,8 @@ define JQ_DOCKER_BAKE
143
147
args: {
144
148
FROM: "${BASE_IMAGE}"
145
149
},
150
+ "cache-to": ["type=registry,ref=" + ($$ARGS.named[(. + "-cache")]) + ",mode=max"],
151
+ "cache-from": ["type=registry,ref=" + ($$ARGS.named[(. + "-cache")])],
146
152
tags: [
147
153
($$ARGS.named[(.)])
148
154
]
@@ -161,6 +167,7 @@ docker-bake.json: Makefile
161
167
jq " $$ JQ_DOCKER_BAKE" \
162
168
--null-input \
163
169
$(foreach name,$(IMAGES ) ,--arg $(name ) $(call sub_image,$(name ) ) ) \
170
+ $(foreach name,$(IMAGES ) ,--arg $(name ) -cache $(call sub_cache_image,$(name ) ) ) \
164
171
--args $(IMAGES ) \
165
172
> $@
166
173
0 commit comments