Allow choice of container engine in Makefile

This commit is contained in:
Wojciech Kozlowski 2019-11-30 12:42:10 +01:00
parent 7dc1dd792f
commit 5259e5a3ec

View File

@ -12,11 +12,18 @@ uninstall:
rm /lib/systemd/system/loki-server.service rm /lib/systemd/system/loki-server.service
systemctl daemon-reload 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. # The container registry to use.
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
DOCKER_REGISTRY = registry.wojciechkozlowski.eu/wojtek/loki REGISTRY = registry.wojciechkozlowski.eu/wojtek/loki
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Default target. # Default target.
@ -28,19 +35,19 @@ default: all
# html # html
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
HTML = $(DOCKER_REGISTRY)/html HTML = $(REGISTRY)/html
html-clean: html-clean:
docker rmi $(HTML) || /bin/true $(ENGINE) rmi $(HTML) || /bin/true
html-build: html-build:
docker build -f html/Dockerfile -t $(HTML) ./html $(ENGINE) build -f html/Dockerfile -t $(HTML) ./html
html-push: html-push:
docker push $(HTML) $(ENGINE) push $(HTML)
html-pull: html-pull:
docker pull $(HTML) $(ENGINE) pull $(HTML)
html: html-clean html-build html-push html: html-clean html-build html-push
@ -48,19 +55,19 @@ html: html-clean html-build html-push
# proxy # proxy
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
PROXY = $(DOCKER_REGISTRY)/proxy PROXY = $(REGISTRY)/proxy
proxy-clean: proxy-clean:
docker rmi $(PROXY) || /bin/true $(ENGINE) rmi $(PROXY) || /bin/true
proxy-build: proxy-build:
docker build -f proxy/Dockerfile -t $(PROXY) ./proxy $(ENGINE) build -f proxy/Dockerfile -t $(PROXY) ./proxy
proxy-push: proxy-push:
docker push $(PROXY) $(ENGINE) push $(PROXY)
proxy-pull: proxy-pull:
docker pull $(PROXY) $(ENGINE) pull $(PROXY)
proxy: proxy-clean proxy-build proxy-push proxy: proxy-clean proxy-build proxy-push
@ -68,19 +75,19 @@ proxy: proxy-clean proxy-build proxy-push
# wiki # wiki
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
WIKI = $(DOCKER_REGISTRY)/wiki WIKI = $(REGISTRY)/wiki
wiki-clean: wiki-clean:
docker rmi $(WIKI) || /bin/true $(ENGINE) rmi $(WIKI) || /bin/true
wiki-build: wiki-build:
docker build -f dokuwiki/Dockerfile -t $(WIKI) ./dokuwiki $(ENGINE) build -f dokuwiki/Dockerfile -t $(WIKI) ./dokuwiki
wiki-push: wiki-push:
docker push $(WIKI) $(ENGINE) push $(WIKI)
wiki-pull: wiki-pull:
docker pull $(WIKI) $(ENGINE) pull $(WIKI)
wiki: wiki-clean wiki-build wiki-push wiki: wiki-clean wiki-build wiki-push
@ -88,19 +95,19 @@ wiki: wiki-clean wiki-build wiki-push
# nextcloud # nextcloud
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
NEXTCLOUD = $(DOCKER_REGISTRY)/nextcloud NEXTCLOUD = $(REGISTRY)/nextcloud
nextcloud-clean: nextcloud-clean:
docker rmi $(NEXTCLOUD) || /bin/true $(ENGINE) rmi $(NEXTCLOUD) || /bin/true
nextcloud-build: nextcloud-build:
docker build -f nextcloud/Dockerfile -t $(NEXTCLOUD) ./nextcloud $(ENGINE) build -f nextcloud/Dockerfile -t $(NEXTCLOUD) ./nextcloud
nextcloud-push: nextcloud-push:
docker push $(NEXTCLOUD) $(ENGINE) push $(NEXTCLOUD)
nextcloud-pull: nextcloud-pull:
docker pull $(NEXTCLOUD) $(ENGINE) pull $(NEXTCLOUD)
nextcloud: nextcloud-clean nextcloud-build nextcloud-push nextcloud: nextcloud-clean nextcloud-build nextcloud-push
@ -109,8 +116,8 @@ nextcloud: nextcloud-clean nextcloud-build nextcloud-push
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
clean-all: clean-all:
docker container prune -f $(ENGINE) container prune -f
docker image prune -a -f $(ENGINE) image prune -a -f
clean-builds: \ clean-builds: \
html-clean \ html-clean \