31 lines
912 B
Makefile
31 lines
912 B
Makefile
include config.mk
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
# Autogenerated lists
|
|
CONTAINERS := $(shell find ./ -maxdepth 2 -name 'Containerfile' | cut -d'/' -f2)
|
|
IMAGES := $(addsuffix /${IMAGE_OUTPUT},${CONTAINERS})
|
|
|
|
# Build all containers in order by default
|
|
all: $(CONTAINERS)
|
|
|
|
# Build process
|
|
$(CONTAINERS): % : %/${IMAGE_OUTPUT}
|
|
|
|
# This needs to be one single target, otherwise the caching relation between Containerfile and the image is not present
|
|
# This also needs to save to local default storage as a intermediate so containers depending on eachother can source the contents
|
|
%/${IMAGE_OUTPUT}: %/Containerfile
|
|
buildah build -t $(DOMAIN)/$* $*
|
|
buildah push $(DOMAIN)/$* oci-archive:$@:$(DOMAIN)/$*:$(shell date +%s)
|
|
buildah push $(DOMAIN)/$* oci-archive:$@:$(DOMAIN)/$*:latest
|
|
|
|
%/Containerfile:
|
|
$(error Containerfile $@ is not present)
|
|
|
|
# Clean up
|
|
clean:
|
|
-rm -rv $(IMAGES)
|
|
|
|
.PHONY: all clean $(CONTAINERS)
|
|
.SUFFIXES:
|