2020-01-17 20:19:12 +00:00
|
|
|
BUILDDIR?=../ungleich-staticcms-build
|
2019-12-31 00:39:46 +00:00
|
|
|
DESTINATION=ungleichstatic@staticweb.ungleich.ch:/home/services/www/ungleichstatic/staticcms.ungleich.ch/www/u/
|
2019-09-24 12:13:26 +00:00
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
VENV_PATH=../venv
|
2024-10-13 02:45:12 +00:00
|
|
|
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
|
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
# These run outside the container
|
2024-10-13 02:50:09 +00:00
|
|
|
all: argocd
|
2024-10-13 02:45:12 +00:00
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
argocd: container
|
|
|
|
sed -i "s,$(IMAGE_NAME):.*,$(IMAGE_NAME):$(VERSION)," $(ARGOCD_APP)
|
2024-11-15 12:48:58 +00:00
|
|
|
cd $(ARGOCD_HOME) && git pull && git add $(ARGOCD_YAML) && git commit -m "[staticweb] Update ungleich-staticcms to $(VERSION)" $(ARGOCD_YAML) && git push
|
2024-10-19 00:55:55 +00:00
|
|
|
|
2024-10-13 02:45:12 +00:00
|
|
|
container: push
|
|
|
|
docker build -t $(IMAGE_NAME):$(VERSION) .
|
|
|
|
docker push $(IMAGE_NAME):$(VERSION)
|
|
|
|
|
2024-11-15 12:19:54 +00:00
|
|
|
justcontainer:
|
|
|
|
docker build -t $(IMAGE_NAME):$(VERSION) .
|
|
|
|
|
2024-11-15 12:47:23 +00:00
|
|
|
push: pull
|
2024-10-19 00:55:55 +00:00
|
|
|
git push
|
2019-09-24 12:13:26 +00:00
|
|
|
|
2019-09-25 12:31:06 +00:00
|
|
|
pull:
|
|
|
|
git pull
|
|
|
|
|
2024-11-15 13:19:41 +00:00
|
|
|
run: justcontainer
|
|
|
|
docker run -p 8082:80 $(IMAGE_NAME):$(VERSION)
|
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
# These run inside the container
|
|
|
|
build: venv
|
|
|
|
. $(VENV_PATH)/bin/activate && lektor build -O $(BUILDDIR)
|
2021-12-05 13:24:25 +00:00
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
venv: requirements.txt
|
|
|
|
python3 -m venv $(VENV_PATH)
|
|
|
|
sh -c ". $(VENV_PATH)/bin/activate && pip install -r requirements.txt"
|
2021-12-05 13:24:25 +00:00
|
|
|
|
2024-10-19 00:55:55 +00:00
|
|
|
# Pre container targets (kept for reference)
|
2020-01-17 20:19:12 +00:00
|
|
|
publish: pull build deploy
|
|
|
|
|
|
|
|
deploy: permissions
|
2019-12-31 00:39:46 +00:00
|
|
|
rsync -av --delete --exclude .lektor/ $(BUILDDIR)/u/ $(DESTINATION)
|
2020-01-13 02:07:57 +00:00
|
|
|
rsync -av --delete $(BUILDDIR)/sitemap.xml $(DESTINATION)
|
2020-01-17 20:19:12 +00:00
|
|
|
|
2019-09-24 12:13:26 +00:00
|
|
|
permissions: build
|
|
|
|
find $(BUILDDIR) -type f -exec chmod 0644 {} \;
|
|
|
|
find $(BUILDDIR) -type d -exec chmod 0755 {} \;
|
|
|
|
|
2019-11-18 14:36:27 +00:00
|
|
|
clean:
|
2019-12-31 00:39:46 +00:00
|
|
|
rm -rf $(BUILDDIR)
|