45 lines
1.1 KiB
Makefile
45 lines
1.1 KiB
Makefile
SHELL := /bin/bash
|
|
|
|
APP_PORT ?= 18080
|
|
DATA_FILES := ../data/classnotes.txt ../data/学生课时账户.md $(wildcard ../data/admin_tasks.json)
|
|
|
|
.PHONY: check smoke data-hash build up ps health deploy logs install-gitea-backup
|
|
|
|
check:
|
|
node --check app/static/app.js
|
|
node --check app/static/admin.js
|
|
python3 -m py_compile app/main.py app/data.py
|
|
|
|
smoke:
|
|
node scripts/smoke_test.js
|
|
|
|
data-hash:
|
|
sha256sum $(DATA_FILES)
|
|
|
|
build:
|
|
docker compose build
|
|
|
|
up:
|
|
docker compose up -d
|
|
|
|
ps:
|
|
docker compose ps
|
|
|
|
health:
|
|
set -a; . ./.env; curl --fail --silent --show-error --retry 10 --retry-delay 1 --retry-connrefused --retry-all-errors -u "records:$${BASIC_AUTH_PASSWORD}" "http://127.0.0.1:$${APP_PORT:-$(APP_PORT)}/api/health"; echo
|
|
|
|
deploy: check smoke
|
|
$(MAKE) --no-print-directory data-hash
|
|
$(MAKE) --no-print-directory build
|
|
$(MAKE) --no-print-directory up
|
|
sleep 2
|
|
$(MAKE) --no-print-directory health
|
|
$(MAKE) --no-print-directory data-hash
|
|
$(MAKE) --no-print-directory ps
|
|
|
|
logs:
|
|
docker compose logs --tail=120 xsk-records-web
|
|
|
|
install-gitea-backup:
|
|
python3 scripts/install_gitea_backup_hook.py
|