2021-03-11 21:36:59 +01:00
|
|
|
CACHEDIR=/tmp/hugo-cache-$(USER)
|
2021-03-11 20:20:06 +01:00
|
|
|
DESTDIR=public/
|
2021-10-14 09:10:08 +02:00
|
|
|
HOSTNAME=$(shell hostname)
|
2022-09-06 22:22:54 +02:00
|
|
|
REVISION=$(shell git rev-parse HEAD)
|
2021-03-11 18:53:14 +01:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: ## make build # builds an optimized version of the website in $(DESTDIR)
|
2021-03-11 20:20:06 +01:00
|
|
|
@echo "----- Generating site -----"
|
2021-03-11 21:36:59 +01:00
|
|
|
hugo --gc --minify --cleanDestinationDir -d $(DESTDIR) --cacheDir $(CACHEDIR)
|
2021-09-12 14:03:45 +02:00
|
|
|
cp public/index.json search/
|
|
|
|
cp public/search/index.html search/
|
|
|
|
(cd search && CGO_ENABLED=0 go build -ldflags '-s -w -extldflags "-static"' ./search.go)
|
2021-03-11 18:53:14 +01:00
|
|
|
|
2022-09-06 00:40:46 +02:00
|
|
|
.PHONY: buildah
|
|
|
|
buildah: ## make buildah # builds the container images
|
|
|
|
deploy/build-image.sh
|
|
|
|
|
2022-09-06 22:22:54 +02:00
|
|
|
.PHONY: push
|
|
|
|
push: ## make push # push the built images to quay.io
|
|
|
|
buildah push adyxax/www quay.io/adyxax/www:$(REVISION)
|
|
|
|
buildah push adyxax/www-search quay.io/adyxax/www-search:$(REVISION)
|
|
|
|
|
2021-03-11 18:53:14 +01:00
|
|
|
.PHONY: clean
|
|
|
|
clean: ## make clean # removed all $(DESTDIR) contents
|
2021-03-11 20:20:06 +01:00
|
|
|
@echo "----- Cleaning old build -----"
|
2021-09-12 14:03:45 +02:00
|
|
|
rm -f search/index.html search/index.json search/search
|
2021-10-28 21:22:36 +02:00
|
|
|
rm -rf $(DESTDIR)
|
2021-03-11 18:53:14 +01:00
|
|
|
|
|
|
|
.PHONY: serve
|
|
|
|
serve: ## make serve # hugo web server development mode
|
2021-10-14 09:10:08 +02:00
|
|
|
hugo serve --disableFastRender --noHTTPCache --cacheDir $(CACHEDIR) --bind 0.0.0.0 --port 1313 -b http://$(HOSTNAME):1313/
|
2021-03-11 18:53:14 +01:00
|
|
|
|
|
|
|
help:
|
2022-09-08 13:53:45 +02:00
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
2021-03-11 18:53:14 +01:00
|
|
|
|
|
|
|
.DEFAULT_GOAL := help
|