diff --git a/Makefile b/Makefile index e84e1ac6..179e776e 100644 --- a/Makefile +++ b/Makefile @@ -3,23 +3,32 @@ PUBDIR=tee.schottelius.org:/home/services/www/nico/www.nico.schottelius.org/www/ BROWSER=conkeror IKIWIKI=ikiwiki -VERSION=$(shell git describe --always) +VERSION=$(shell git describe --always --dirty) ARGOCD_HOME=$$HOME/vcs/k8s-config/cluster/p10/apps/templates/ ARGOCD_YAML=staticweb-nico.yaml ARGOCD_APP=$(ARGOCD_HOME)/$(ARGOCD_YAML) IMAGE_NAME=harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org +CONTAINER_NAME=$(IMAGE_NAME):$(VERSION) all: argocd -gitpush: +checkclean: + echo $(VERSION) | grep -q dirty && exit 1 + +push-git: git push --mirror -container: gitpush - docker build -t harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:$(VERSION) . - docker push harbor.k8s.ungleich.ch/nico/www.nico.schottelius.org:$(VERSION) +build-container: + docker build -t $(CONTAINER_NAME) . -argocd: container +push-container: build-container + docker push $(CONTAINER_NAME) + +run: build-container + docker run --rm -p 8000:80 $(CONTAINER_NAME) + +argocd: checkclean push-container push-git sed -i "s,$(IMAGE_NAME):.*,$(IMAGE_NAME):$(VERSION)," $(ARGOCD_APP) cd $(ARGOCD_HOME) && git add $(ARGOCD_YAML) && git commit -m "[staticweb] Update www.nico.schottelius.org to $(VERSION)" $(ARGOCD_YAML) && git push