dynamic targets for images

This commit is contained in:
nbykov0
2024-06-24 19:42:12 +03:00
parent cffb825711
commit b4ad5f8d85
2 changed files with 26 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ TYPE=system
include ../../../scripts/common-envs.mk
include ../../../scripts/package-system.mk
update: update-charts update-dockerfiles
update: update-charts update-dockerfiles update-images
update-charts:
rm -rf charts
@@ -15,7 +15,23 @@ update-charts:
rm -rf charts/cluster-api-operator/charts
update-dockerfiles:
../../../scripts/update-dockerfiles.sh with_helm
../../../hack/update-dockerfiles.sh with_helm
components := $(subst /,,$(subst images/,,$(dir $(wildcard images/*/Dockerfile))))
img_targets := $(addprefix image-,$(components))
update-images: $(img-targets)
.PHONY = $(img_targets)
$(img_targets):
@$(eval name := $(subst image-,,$@))
@$(eval tag := $(shell egrep -o "FROM .*$(name).*" images/$(name)/Dockerfile | awk -F: '{print $$NF}'))
BUILDX_METADATA_PROVENANCE=0 docker buildx build images/$(name)/ \
--provenance false \
--tag $(subst //,/,$(REGISTRY)/$(TYPE)/$(name):$(tag)) \
--cache-from type=registry,ref=$(subst //,/,$(REGISTRY)/$(TYPE)/$(name):latest) \
--cache-to type=inline \
--metadata-file images/$(name).json \
--push=$(PUSH) \
--load=$(LOAD)
image:
../../../scripts/build-images.sh $(REGISTRY) $(NAME) $(TYPE) $(PUSH) $(LOAD)

View File

@@ -0,0 +1,6 @@
{
"buildx.build.ref": "default/default/7nxaun3sgw6z95qhgc4c873qo",
"containerimage.config.digest": "sha256:0ff1e569cc97f686d6c0c9ed6e6396c72eca93df746e7ca469f97124cae1e73d",
"containerimage.digest": "sha256:79282412e0b891630235ecf919c45b0531f25a0926825385a51bb2a7dde880fb",
"image.name": "localhost:5000/aenix-io/cozystack/system/cluster-api-operator:v0.8.1"
}