From 5259e5a3ec29157215575cdd55bf194bd9478aa7 Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Sat, 30 Nov 2019 12:42:10 +0100 Subject: [PATCH] Allow choice of container engine in Makefile --- Makefile | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 0ae2fc5..3c2ccfd 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,18 @@ uninstall: rm /lib/systemd/system/loki-server.service systemctl daemon-reload +#------------------------------------------------------------------------------ +# The container engine to use. Default to docker, but on Fedora must now use +# podman. +# ------------------------------------------------------------------------------ + +ENGINE = docker + # ----------------------------------------------------------------------------- # The container registry to use. # ----------------------------------------------------------------------------- -DOCKER_REGISTRY = registry.wojciechkozlowski.eu/wojtek/loki +REGISTRY = registry.wojciechkozlowski.eu/wojtek/loki # ----------------------------------------------------------------------------- # Default target. @@ -28,19 +35,19 @@ default: all # html # ----------------------------------------------------------------------------- -HTML = $(DOCKER_REGISTRY)/html +HTML = $(REGISTRY)/html html-clean: - docker rmi $(HTML) || /bin/true + $(ENGINE) rmi $(HTML) || /bin/true html-build: - docker build -f html/Dockerfile -t $(HTML) ./html + $(ENGINE) build -f html/Dockerfile -t $(HTML) ./html html-push: - docker push $(HTML) + $(ENGINE) push $(HTML) html-pull: - docker pull $(HTML) + $(ENGINE) pull $(HTML) html: html-clean html-build html-push @@ -48,19 +55,19 @@ html: html-clean html-build html-push # proxy # ----------------------------------------------------------------------------- -PROXY = $(DOCKER_REGISTRY)/proxy +PROXY = $(REGISTRY)/proxy proxy-clean: - docker rmi $(PROXY) || /bin/true + $(ENGINE) rmi $(PROXY) || /bin/true proxy-build: - docker build -f proxy/Dockerfile -t $(PROXY) ./proxy + $(ENGINE) build -f proxy/Dockerfile -t $(PROXY) ./proxy proxy-push: - docker push $(PROXY) + $(ENGINE) push $(PROXY) proxy-pull: - docker pull $(PROXY) + $(ENGINE) pull $(PROXY) proxy: proxy-clean proxy-build proxy-push @@ -68,19 +75,19 @@ proxy: proxy-clean proxy-build proxy-push # wiki # ----------------------------------------------------------------------------- -WIKI = $(DOCKER_REGISTRY)/wiki +WIKI = $(REGISTRY)/wiki wiki-clean: - docker rmi $(WIKI) || /bin/true + $(ENGINE) rmi $(WIKI) || /bin/true wiki-build: - docker build -f dokuwiki/Dockerfile -t $(WIKI) ./dokuwiki + $(ENGINE) build -f dokuwiki/Dockerfile -t $(WIKI) ./dokuwiki wiki-push: - docker push $(WIKI) + $(ENGINE) push $(WIKI) wiki-pull: - docker pull $(WIKI) + $(ENGINE) pull $(WIKI) wiki: wiki-clean wiki-build wiki-push @@ -88,19 +95,19 @@ wiki: wiki-clean wiki-build wiki-push # nextcloud # ----------------------------------------------------------------------------- -NEXTCLOUD = $(DOCKER_REGISTRY)/nextcloud +NEXTCLOUD = $(REGISTRY)/nextcloud nextcloud-clean: - docker rmi $(NEXTCLOUD) || /bin/true + $(ENGINE) rmi $(NEXTCLOUD) || /bin/true nextcloud-build: - docker build -f nextcloud/Dockerfile -t $(NEXTCLOUD) ./nextcloud + $(ENGINE) build -f nextcloud/Dockerfile -t $(NEXTCLOUD) ./nextcloud nextcloud-push: - docker push $(NEXTCLOUD) + $(ENGINE) push $(NEXTCLOUD) nextcloud-pull: - docker pull $(NEXTCLOUD) + $(ENGINE) pull $(NEXTCLOUD) nextcloud: nextcloud-clean nextcloud-build nextcloud-push @@ -109,8 +116,8 @@ nextcloud: nextcloud-clean nextcloud-build nextcloud-push # ----------------------------------------------------------------------------- clean-all: - docker container prune -f - docker image prune -a -f + $(ENGINE) container prune -f + $(ENGINE) image prune -a -f clean-builds: \ html-clean \