51 lines
1.7 KiB
Makefile
51 lines
1.7 KiB
Makefile
.PHONY: default build clean release require_clean_git
|
|
|
|
-include .env
|
|
|
|
VERSION=20230926
|
|
IMAGENAME=dnsmasq
|
|
REPO=git.rre.nu/jonas
|
|
TITLE=dnsmasq based on openSUSE Tumpleweed
|
|
DESC=Image containing dnsmasq, based on openSUSE Tumbleweed
|
|
|
|
SHELL := /bin/bash
|
|
|
|
default: build
|
|
|
|
require_clean_git:
|
|
git update-index -q --ignore-submodules --refresh
|
|
git diff-files --quiet --ignore-submodules
|
|
git diff-index --cached --quiet --ignore-submodules HEAD --
|
|
@status=$$(git status --porcelain); \
|
|
if test "x$${status}" = x; then \
|
|
echo "No untracked files detected"; \
|
|
else \
|
|
echo "Untracked files detected" >&2; \
|
|
exit 1; \
|
|
fi
|
|
|
|
build:
|
|
podman build \
|
|
--build-arg VERSION="$(VERSION)" \
|
|
--label org.opencontainers.image.source="https://${REPO}/${IMAGENAME}/src/tag/v${VERSION}" \
|
|
--label org.opencontainers.image.title="${TITLE}" \
|
|
--label org.opencontainers.image.description="${DESC}" \
|
|
--label org.opencontainers.image.created="$(shell TZ=UTC date --iso-8601=ns)" \
|
|
--label org.opencontainers.image.url="https://${REPO}/-/packages/container/${IMAGENAME}/${VERSION}" \
|
|
--label org.opencontainers.image.version="${VERSION}" \
|
|
--label org.opencontainers.image.vendor="Jonas Forsberg" \
|
|
--tag ${REPO}/${IMAGENAME}:$(VERSION) \
|
|
.
|
|
|
|
clean:
|
|
podman image rm ${REPO}/${IMAGENAME}:$(VERSION)
|
|
|
|
release: require_clean_git build
|
|
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/sbin/dnsmasq --version))
|
|
git tag -a v$(VERSION) -m "dnsmasq version: ${TMP_MESSAGE}"
|
|
git push origin v$(VERSION)
|
|
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
|
@ echo "Pushing images"
|
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|