-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (60 loc) Β· 2.8 KB
/
Copy pathMakefile
File metadata and controls
80 lines (60 loc) Β· 2.8 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
69
70
71
72
73
74
75
76
77
78
79
80
.PHONY: dev build up down start stop restart status logs test migrate shell
DC := docker compose -f docker-compose.yml -f docker-compose.local.yml
# ββ Dev ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Backend dev server (auto-reload, no Docker)
dev:
cd backend && uvicorn forkit.main:app --reload --host 0.0.0.0 --port 8001
# ββ Build ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Build Docker image (frontend built inside Docker)
build:
$(DC) build
# Rebuild from scratch (no cache)
rebuild:
$(DC) build --no-cache
# ββ Lifecycle ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Start stack (build first if image missing)
start: up
up:
$(DC) up -d
@echo ""
@$(MAKE) --no-print-directory status
# Stop containers (preserve data volume)
stop: down
down:
$(DC) down
# Stop, rebuild image, start
restart:
$(DC) down
$(DC) build
$(DC) up -d
@echo ""
@$(MAKE) --no-print-directory status
# ββ Status βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
status:
@echo "=== containers ==="
@$(DC) ps
@echo ""
@echo "=== health ==="
@$(DC) ps --format "{{.Name}} {{.Status}}" | grep -v "^$$" || true
@echo ""
@PORT=$$($(DC) port web 8000 2>/dev/null | cut -d: -f2); \
if [ -n "$$PORT" ]; then \
echo " app β http://localhost:$$PORT"; \
curl -sf http://localhost:$$PORT/healthz | python3 -m json.tool 2>/dev/null || echo " (healthz not ready yet)"; \
else \
echo " (not running)"; \
fi
# ββ Data βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Run Alembic migrations inside the running container
migrate:
$(DC) exec web alembic upgrade head
# Open a shell in the web container
shell:
$(DC) exec web /bin/bash
# Tail logs (all services, or: make logs s=web)
logs:
$(DC) logs -f $(s)
# ββ Test βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
test:
cd backend && python -m pytest
cd frontend && npm test