diff --git a/Makefile b/Makefile index cd28fa5..645807b 100644 --- a/Makefile +++ b/Makefile @@ -44,4 +44,34 @@ shell: $(IMAGE) /bin/sh help: - @printf "Usage:\n make build Build local docker image ($(IMAGE))\n make run Run image mounting project into $(WORKDIR) (port $(PORT))\n make stop Stop running container\n make shell Start a shell in a container with project mounted\n\nOverride variables: IMAGE, CONTAINER, WORKDIR, PORT, DOCKER_BUILD_ARGS, DOCKER_RUN_ARGS\n" \ No newline at end of file + @printf "Usage:\n make build Build local docker image ($(IMAGE))\n make run Run image mounting project into $(WORKDIR) (port $(PORT))\n make stop Stop running container\n make shell Start a shell in a container with project mounted\n\nOverride variables: IMAGE, CONTAINER, WORKDIR, PORT, DOCKER_BUILD_ARGS, DOCKER_RUN_ARGS\n" + +git_info: + $(eval GIT_HASH = $(shell git rev-parse HEAD)) + $(eval GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)) + + +publish: git_info + $(eval VERSION = $(shell git describe --tags 2>/dev/null | grep -e '^[0-9]\.[0-9]*\.[0-9]')) + @if [ -z "${VERSION}" ]; \ + then \ + echo "Error: Nincs verzió szám"; \ + exit 1; \ + fi + #@sudo docker login $(DOCKER_REGISTRY) + @sudo docker build \ + --no-cache \ + --label version=$(VERSION) \ + --label org.opencontainers.image.created=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \ + --label org.opencontainers.image.authors="Krisztián Szabolcsi" \ + --label org.opencontainers.image.version=$(VERSION) \ + --label org.opencontainers.image.licences=MIT \ + --label org.opencontainers.image.source=https://${DOCKER_REGISTRY}/${OWNER}/${NAME} \ + --label org.opencontainers.image.revision=$(GIT_HASH) \ + --label org.opencontainers.image.vendor="Krisztián Szabolcsi" \ + --label org.opencontainers.image.description="IMAP email notification service using ntfy.sh" \ + --label org.opencontainers.image.source.branch=$(GIT_BRANCH) \ + --label org.opencontainers.image.source.hash=$(GIT_HASH) \ + -t $(DOCKER_REGISTRY)/${OWNER}/$(NAME):$(VERSION) \ + . + @sudo docker push $(DOCKER_REGISTRY)/$(NAME):$(VERSION) \ No newline at end of file diff --git a/project.env b/project.env index 98778e1..417beb5 100644 --- a/project.env +++ b/project.env @@ -1 +1,2 @@ NAME=imap_notification +DOCKER_REGISTRY=gitea.szabolcsi.dev \ No newline at end of file