Makefile 1.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
DISTROS := debian ubuntu
ARCHS := amd64 i386

debian_VERSIONS := jessie stretch buster sid
ubuntu_VERSIONS := trusty xenial artful bionic

TARGETS := $(foreach arch,$(ARCHS),$(foreach distro,$(DISTROS),$(foreach version,$($(distro)_VERSIONS),$(distro)-$(version)-$(arch))))

all: $(TARGETS)

.PHONY: $(TARGETS)

$(TARGETS): VENDOR = $(word 1,$(subst -, ,$@))
$(TARGETS): VERSION = $(word 2,$(subst -, ,$@))
$(TARGETS): ARCH = $(subst amd64,,$(subst i386,i386/,$(word 3,$(subst -, ,$@))))
$(TARGETS): SOURCE_IMAGE = $(ARCH)$(VENDOR):$(VERSION)
$(TARGETS): CI_REGISTRY_NAME = bind9:$@
$(TARGETS):
	$(info Building $(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME) from $(SOURCE_IMAGE))
	mkdir -p docker/bind9/$@
	sed \
	  -e 's,@VERSION@,$(VERSION),' \
	  -e 's,@ARCH@,$(ARCH),' \
	  -e 's,@VENDOR@,$(VENDOR),' \
	  -e 's,@SOURCE_IMAGE@,$(SOURCE_IMAGE),' \
	  < docker/bind9/$(VENDOR)-template/Dockerfile \
	  > docker/bind9/$@/Dockerfile
	docker build --no-cache -t "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)" "docker/bind9/$@"
	docker push "$(CI_REGISTRY_IMAGE)/$(CI_REGISTRY_NAME)"
	rm -rf docker/bind9/$@