53 lines
1.5 KiB
Makefile
53 lines
1.5 KiB
Makefile
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
|
|
ARGOCD_APP=$(ARGOCD_HOME)/$(ARGOCD_YAML)
|
|
|
|
IMAGE_NAME=harbor.k8s.ungleich.ch/ungleich-public/ungleich-staticcms
|
|
|
|
# These run outside the container
|
|
all: argocd
|
|
|
|
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
|
|
|
|
container: push
|
|
docker build -t $(IMAGE_NAME):$(VERSION) .
|
|
docker push $(IMAGE_NAME):$(VERSION)
|
|
|
|
justcontainer:
|
|
docker build -t $(IMAGE_NAME):$(VERSION) .
|
|
docker push $(IMAGE_NAME):$(VERSION)
|
|
|
|
push:
|
|
git 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
|
|
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 {} \;
|
|
|
|
clean:
|
|
rm -rf $(BUILDDIR)
|