Add pushing wanted images and rename targets, remove secondary

This commit is contained in:
Alex D. 2025-04-26 15:08:20 +00:00
parent 94a521c1ea
commit 6abfb6fb9c
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
3 changed files with 20 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
build_id
build_log
repo_stamp
push_stamp
repo/
secrets/

View File

@ -5,15 +5,24 @@ CONTAINERS := $(shell find ./ -name '${BUILD_INSTRUCTIONS}' -exec 'dirname' '{}'
BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS})
BUILD_LOGS := $(addsuffix /${BUILD_LOG},${CONTAINERS})
REPO_STAMPS := $(addsuffix /${REPO_STAMP},${CONTAINERS})
PUSH_STAMPS := $(addsuffix /${PUSH_STAMP},${CONTAINERS})
WANTED_REPO_STAMPS := $(addsuffix /${REPO_STAMP},${WANTED_IMAGES})
WANTED_PUSH_STAMPS := $(addsuffix /${PUSH_STAMP},${WANTED_IMAGES})
# Make workaround
# Inserting literal commas into function calls without interpreting them as delimiters
, := ,
unified: $(WANTED_REPO_STAMPS)
remote: $(WANTED_PUSH_STAMPS)
repo: $(WANTED_REPO_STAMPS)
localbuild: $(BUILD_IDS)
%/${PUSH_STAMP}: %/${BUILD_ID_OUT}
buildah push \
$(shell cat $<) \
docker://${PUSH_SPEC}/$*:latest
@touch -- $@
# Build process
# flock required due to https://github.com/containers/buildah/issues/5581
%/${REPO_STAMP}: %/${BUILD_ID_OUT}
@ -39,7 +48,7 @@ localbuild: $(BUILD_IDS)
$*
# Clean up
clean: cleanbuild cleanlogs cleanrepostamps cleanrepo
clean: cleanbuild cleanlogs cleanrepostamps cleanpushstamps cleanrepo
cleanlogs:
-rm -rv -- ${BUILD_LOGS}
@ -47,14 +56,17 @@ cleanlogs:
cleanbuild:
-rm -rv -- ${BUILD_IDS}
cleanpushstamps:
-rm -rv -- ${PUSH_STAMPS}
cleanrepostamps:
-rm -rv -- ${REPO_STAMPS}
cleanrepo: cleanrepostamps
-rm -rv -- ${REPO_DIR}
.PHONY: all clean cleanbuild cleanlogs cleanrepostamps cleanrepo localbuild unified
.PHONY: all clean cleanbuild cleanlogs cleanrepostamps cleanpushstamps cleanrepo localbuild repo remote
.SUFFIXES:
# Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug*
.SECONDARY: $(BUILD_IDS) $(REPO_STAMPS)
.SECONDARY: $(BUILD_IDS)

View File

@ -2,9 +2,11 @@ BUILD_ID_OUT := build_id
BUILD_LOG := build_log
BUILD_INSTRUCTIONS := Containerfile
CONTAINER_NETWORK := none
PUSH_SPEC := localhost:5000
PUSH_STAMP := push_stamp
REPO_DIR := repo
REPO_STAMP := repo_stamp
.DEFAULT_GOAL := unified
.DEFAULT_GOAL := repo
WANTED_IMAGES := \
redxen.eu/daemons/alloy \
redxen.eu/daemons/dovecot \