ungleich-staticcms/Makefile
2024-10-13 11:50:09 +09:00

48 lines
1.3 KiB
Makefile

BUILDDIR?=../ungleich-staticcms-build
DESTINATION=ungleichstatic@staticweb.ungleich.ch:/home/services/www/ungleichstatic/staticcms.ungleich.ch/www/u/
VERSION=$(shell git describe --always)
ARGOCD_HOME=$$HOME/vcs/k8s-config/cluster/p10/apps/templates/
ARGOCD_YAML=staticweb-ungleich.yaml
ARGOCD_APP=$(ARGOCD_HOME)/$(ARGOCD_YAML)
IMAGE_NAME=harbor.k8s.ungleich.ch/ungleich-public/ungleich-staticcms
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 "Update ungleich-staticcms to $(VERSION)" $(ARGOCD_YAML) && git push
pull:
git pull
push:
git push
goodpush:
make publish && make push
publish: pull build deploy
deploy: permissions
rsync -av --delete --exclude .lektor/ $(BUILDDIR)/u/ $(DESTINATION)
rsync -av --delete $(BUILDDIR)/sitemap.xml $(DESTINATION)
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"