Files
container-postfix/Makefile
T
unkin-agent 8736092555
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
Scaffold postfix smarthost image
2026-10-12 00:32:49 +11:00

45 lines
1.6 KiB
Makefile

REGISTRY := artifactapi.k8s.syd1.au.unkin.net/docker-internal
DISTROS := $(notdir $(wildcard distros/*))
VERSION ?= $(patsubst v%,%,$(or $(shell git describe --tags --exact-match 2>/dev/null),0.1.0-dev))
.PHONY: build test clean pre-commit patch minor major
build: $(addprefix build-,$(DISTROS))
test: $(addprefix test-,$(DISTROS))
clean: $(addprefix clean-,$(DISTROS))
pre-commit:
@uvx pre-commit run --all-files
# Not .PHONY: GNU make skips implicit-rule search for phony targets.
build-%:
@set -eu; . ./distros/$*/distro.env; \
docker build --build-arg "BASE_IMAGE_NAME=$$BASE_IMAGE_NAME" --build-arg "DISTRO=$*" \
--target image -t "$(REGISTRY)/$$IMAGE:$(VERSION)-$$TAG_SUFFIX" .
test-%:
@set -eu; . ./distros/$*/distro.env; \
docker build --build-arg "BASE_IMAGE_NAME=$$BASE_IMAGE_NAME" --build-arg "DISTRO=$*" --target test .
clean-%:
@set -eu; . ./distros/$*/distro.env; \
docker rmi "$(REGISTRY)/$$IMAGE:$(VERSION)-$$TAG_SUFFIX" 2>/dev/null || true
_LATEST := $(shell git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1)
_BASE := $(if $(_LATEST),$(_LATEST),v0.0.0)
_MAJ := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f1)
_MIN := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f2)
_PAT := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f3)
patch:
@NEW=v$(_MAJ).$(_MIN).$(shell expr $(_PAT) + 1); \
git tag $$NEW && echo "Tagged $$NEW" && git push origin $$NEW
minor:
@NEW=v$(_MAJ).$(shell expr $(_MIN) + 1).0; \
git tag $$NEW && echo "Tagged $$NEW" && git push origin $$NEW
major:
@NEW=v$(shell expr $(_MAJ) + 1).0.0; \
git tag $$NEW && echo "Tagged $$NEW" && git push origin $$NEW