Containers/Makefile

34 lines
801 B
Makefile
Raw Normal View History

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-)
IMAGES := $(addsuffix /${IMAGE_OUTPUT},${CONTAINERS})
2023-06-23 17:31:20 +00:00
BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS})
# Build all containers in order by default
all: $(IMAGES)
# 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 \
-t $(DOMAIN)/$*:latest \
2023-06-23 17:31:20 +00:00
--iidfile $*/${BUILD_ID_OUT} \
2023-06-18 17:18:00 +00:00
$*
# Clean up
clean:
2023-06-23 17:31:20 +00:00
-rm -rv $(IMAGES) $(BUILD_IDS)
.PHONY: all clean
.SUFFIXES:
# Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug*
.INTERMEDIATE: $(BUILD_IDS)