dnsmasq/Makefile

51 lines
1.7 KiB
Makefile
Raw Permalink Normal View History

2023-04-13 15:03:08 +00:00
.PHONY: default build clean release require_clean_git
2023-04-13 12:45:03 +00:00
-include .env
2023-06-21 06:54:26 +00:00
VERSION=20230619
2023-04-13 12:45:03 +00:00
IMAGENAME=dnsmasq
2023-04-17 17:50:21 +00:00
REPO=git.rre.nu/jonas
2023-04-18 12:20:21 +00:00
TITLE=dnsmasq based on openSUSE Tumpleweed
DESC=Image containing dnsmasq, based on openSUSE Tumbleweed
2023-04-13 12:45:03 +00:00
SHELL := /bin/bash
default: build
2023-04-13 15:03:08 +00:00
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 \
2023-04-13 15:08:14 +00:00
echo "No untracked files detected"; \
2023-04-13 15:03:08 +00:00
else \
2023-04-13 15:08:14 +00:00
echo "Untracked files detected" >&2; \
2023-04-13 15:09:44 +00:00
exit 1; \
2023-04-13 15:03:08 +00:00
fi
2023-04-13 12:45:03 +00:00
build:
2023-04-18 12:20:21 +00:00
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) \
.
2023-04-13 12:45:03 +00:00
2023-04-13 15:03:08 +00:00
clean:
2023-04-13 12:45:03 +00:00
podman image rm ${REPO}/${IMAGENAME}:$(VERSION)
2023-04-13 15:03:08 +00:00
release: require_clean_git build
2023-04-13 14:19:02 +00:00
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/sbin/dnsmasq --version))
2023-04-17 12:20:39 +00:00
git tag -a v$(VERSION) -m "dnsmasq version: ${TMP_MESSAGE}"
2023-04-13 12:45:03 +00:00
git push origin v$(VERSION)
2023-04-17 08:17:50 +00:00
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
2023-04-18 12:20:21 +00:00
@ echo "Pushing images"
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest