From a4b7f9eab995cb969ada707fb7fb36ea444731ab Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 19 Oct 2024 09:55:55 +0900 Subject: [PATCH] cleanup makefile Signed-off-by: Nico Schottelius --- Makefile | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 9b0a608..474371f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ BUILDDIR?=../ungleich-staticcms-build DESTINATION=ungleichstatic@staticweb.ungleich.ch:/home/services/www/ungleichstatic/staticcms.ungleich.ch/www/u/ +VENV_PATH=../venv VERSION=$(shell git describe --always) ARGOCD_HOME=$$HOME/vcs/k8s-config/cluster/p10/apps/templates/ ARGOCD_YAML=staticweb-ungleich.yaml @@ -8,25 +9,32 @@ ARGOCD_APP=$(ARGOCD_HOME)/$(ARGOCD_YAML) IMAGE_NAME=harbor.k8s.ungleich.ch/ungleich-public/ungleich-staticcms +# These run outside the container all: argocd -container: push - docker build -t $(IMAGE_NAME):$(VERSION) . - docker push $(IMAGE_NAME):$(VERSION) - argocd: container sed -i "s,$(IMAGE_NAME):.*,$(IMAGE_NAME):$(VERSION)," $(ARGOCD_APP) cd $(ARGOCD_HOME) && git add $(ARGOCD_YAML) && git commit -m "[staticweb] Update ungleich-staticcms to $(VERSION)" $(ARGOCD_YAML) && git push -pull: - git pull +container: push + docker build -t $(IMAGE_NAME):$(VERSION) . + docker push $(IMAGE_NAME):$(VERSION) push: git push -goodpush: - make publish && make push +pull: + git pull +# These run inside the container +build: venv + . $(VENV_PATH)/bin/activate && lektor build -O $(BUILDDIR) + +venv: requirements.txt + python3 -m venv $(VENV_PATH) + sh -c ". $(VENV_PATH)/bin/activate && pip install -r requirements.txt" + +# Pre container targets (kept for reference) publish: pull build deploy deploy: permissions @@ -37,12 +45,5 @@ permissions: build find $(BUILDDIR) -type f -exec chmod 0644 {} \; find $(BUILDDIR) -type d -exec chmod 0755 {} \; -build: venv - . ./venv/bin/activate && lektor build -O $(BUILDDIR) - clean: rm -rf $(BUILDDIR) - -venv: requirements.txt - python3 -m venv venv - sh -c ". ./venv/bin/activate && pip install -r requirements.txt"