Files
crr-shifts/Makefile
T
2026-10-06 01:44:50 +01:00

53 lines
1.3 KiB
Makefile

COMPOSE ?= docker compose
COMPOSE_DEV = $(COMPOSE) -f docker-compose.dev.yml
PYTHON ?= .venv/bin/python
PORT ?= 8000
.PHONY: dev-setup dev dev-up dev-down dev-logs check test-docker migrate revision init-db seed-demo reminders
# Host virtualenv, used for local debugging only. Checks always run in Docker.
dev-setup:
python3 -m venv .venv
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install -r requirements-dev.txt
# Host run with auto-reload, for fast debugging.
dev:
@test -x $(PYTHON) || (echo "Run 'make dev-setup' first." && exit 1)
@mkdir -p data
$(PYTHON) -m uvicorn app.main:app --reload --port $(PORT)
# Full app in Docker with bind mounts and auto-reload.
dev-up:
$(COMPOSE_DEV) up --build
dev-down:
$(COMPOSE_DEV) down
dev-logs:
$(COMPOSE_DEV) logs -f app
# Compile check plus the test suite, inside Docker.
check:
$(COMPOSE_DEV) --profile check run --rm --build checks
test-docker:
$(MAKE) check
# Apply database migrations (also runs automatically on app start).
migrate:
$(PYTHON) -m app.cli migrate
# Autogenerate a migration: make revision m="add something"
revision:
$(PYTHON) -m alembic revision --autogenerate -m "$(m)"
init-db:
$(PYTHON) -m app.cli init-db
seed-demo:
$(PYTHON) -m app.cli seed-demo
reminders:
$(PYTHON) -m app.cli send-reminders