From 6abfb6fb9cf6eba6f7db2aab20b0660c93b50d6f Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Sat, 26 Apr 2025 15:08:20 +0000 Subject: [PATCH] Add pushing wanted images and rename targets, remove secondary --- .gitignore | 1 + Makefile | 20 ++++++++++++++++---- config.mk | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index dc3bfc4..c233a85 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build_id build_log repo_stamp +push_stamp repo/ secrets/ diff --git a/Makefile b/Makefile index 8372846..12863d3 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/config.mk b/config.mk index 2ef7e2f..4b1b9dc 100644 --- a/config.mk +++ b/config.mk @@ -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 \