2023-06-18 16:57:28 +00:00
|
|
|
include config.mk
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
|
|
|
# Autogenerated lists
|
2023-06-23 17:31:20 +00:00
|
|
|
CONTAINERS := $(shell find ./ -name 'Containerfile' -exec 'dirname' '{}' ';' | cut -d'/' -f2-)
|
2023-06-18 16:57:28 +00:00
|
|
|
IMAGES := $(addsuffix /${IMAGE_OUTPUT},${CONTAINERS})
|
2023-06-23 17:31:20 +00:00
|
|
|
BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS})
|
2023-06-18 16:57:28 +00:00
|
|
|
|
|
|
|
# Build all containers in order by default
|
2023-07-12 08:06:56 +00:00
|
|
|
all: $(IMAGES)
|
2023-06-18 16:57:28 +00:00
|
|
|
|
|
|
|
# Build process
|
2023-06-23 17:31:20 +00:00
|
|
|
%/${IMAGE_OUTPUT}: %/${BUILD_ID_OUT}
|
|
|
|
buildah push -f oci \
|
|
|
|
$(shell cat $<) \
|
|
|
|
oci-archive:$@:$(DOMAIN)/$*:latest
|
|
|
|
|
|
|
|
%/${BUILD_ID_OUT}: %/Containerfile
|
2023-06-18 17:18:00 +00:00
|
|
|
buildah build \
|
2023-06-27 09:19:14 +00:00
|
|
|
-t $(DOMAIN)/$*:latest \
|
2023-06-23 17:31:20 +00:00
|
|
|
--iidfile $*/${BUILD_ID_OUT} \
|
2023-06-18 17:18:00 +00:00
|
|
|
$*
|
2023-06-18 16:57:28 +00:00
|
|
|
|
|
|
|
# Clean up
|
|
|
|
clean:
|
2023-06-23 17:31:20 +00:00
|
|
|
-rm -rv $(IMAGES) $(BUILD_IDS)
|
2023-06-18 16:57:28 +00:00
|
|
|
|
2023-07-12 08:06:56 +00:00
|
|
|
.PHONY: all clean
|
2023-06-18 16:57:28 +00:00
|
|
|
.SUFFIXES:
|
2023-07-12 08:06:56 +00:00
|
|
|
|
|
|
|
# Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug*
|
|
|
|
.INTERMEDIATE: $(BUILD_IDS)
|