This commit is contained in:
Philippe Caseiro 2023-06-19 15:55:07 +02:00
parent f08ffe10d8
commit 13ac2b6959
2 changed files with 9 additions and 4 deletions

View File

@ -2,9 +2,11 @@
# Makefile for Cadoles SP
################################
IMAGE_REPO := reg.cadoles.com/cadoles
IMAGE_REPO ?= reg.cadoles.com/cadoles
IMAGE_VERSION ?= 0.0.1
DAY_SUFFIX_TAG ?= $(shell date +%Y%m%d)
COMMIT_ID ?= $(shell git rev-parse --short --verify HEAD)
include main.mk

View File

@ -28,12 +28,12 @@ define install_trivy
endef
define release_image
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) ; \
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID) ; \
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION); \
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \
docker push $(IMAGE_REPO)/$1:latest ; \
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION) ; \
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID)
endef
#list:
@ -57,9 +57,12 @@ release: ${IMAGES_DIR}/*
@for name in $(basename $(notdir $^)); do \
$(call release_image,$${name},base); \
done;\
git tag -f -a $(IMAGE_VERSION) -m "Version $(IMAGE_VERSION) released"; \
git tag -f -a $(IMAGE_VERSION)-$(COMMIT_ID) -m "Version $(IMAGE_VERSION)-$(COMMIT_ID) released"; \
git tag -f -a $(IMAGE_VERSION)-latest -m "Version $(IMAGE_VERSION)-latest released"; \
_release:
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(COMMIT_ID)
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-latest
docker push $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)