-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) Β· 1.52 KB
/
Makefile
File metadata and controls
68 lines (56 loc) Β· 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ----- CONFIG -----
PYTHON := python
PIP := pip
UVICORN_APP := app.main:app
UVICORN_PORT := 4000
VENV := .venv
# ----- HELP -----
.PHONY: help
help:
@echo "Available commands:"
@echo " make venv - Create virtual environment (.venv)"
@echo " make activate - Show command to activate venv"
@echo " make install - Install dependencies from requirements.txt"
@echo " make freeze - Export dependencies to requirements.txt"
@echo " make run - Run FastAPI app with Uvicorn (reload)"
@echo " make db-up - Start Postgres + Mailhog via docker compose"
@echo " make db-down - Stop docker compose services"
@echo " make db-logs - Tail docker compose logs"
@echo " make fmt - (Optional) Format code with black, isort if installed"
# ----- VENV & DEPENDENCIES -----
.PHONY: venv
venv:
$(PYTHON) -m venv $(VENV)
.PHONY: activate
activate:
@echo "Run: source .venv/bin/activate"
.PHONY: install
install:
$(PIP) install -r requirements.txt
.PHONY: freeze
freeze:
$(PIP) freeze > requirements.txt
# ----- RUN APP -----
.PHONY: run
run:
uvicorn $(UVICORN_APP) --reload --host 0.0.0.0 --port $(UVICORN_PORT)
# ----- DOCKER: DB & MAILHOG -----
.PHONY: db-up
db-up:
docker compose up -d
.PHONY: db-down
db-down:
docker compose down
.PHONY: db-logs
db-logs:
docker compose logs -f
# ----- SEED: create initial users -----
.PHONY: seed
seed:
$(PYTHON) scripts/seeder.py
# ----- OPTIONAL: FORMAT -----
.PHONY: fmt
fmt:
@echo "Running formatters (if installed)..."
- black app
- isort app