-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
93 lines (88 loc) · 2.93 KB
/
Copy pathdocker-compose.yml
File metadata and controls
93 lines (88 loc) · 2.93 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
81
82
83
84
85
86
87
88
89
90
91
92
93
version: '3.8'
services:
# ── Redis (Celery broker + result backend) ────────────────────────────────
redis:
image: redis:7-alpine
container_name: kb-redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
# ── FastAPI backend ───────────────────────────────────────────────────────
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: kb-backend
ports:
- "8000:8000"
environment:
- JWT_SECRET=${JWT_SECRET}
- DATABASE_URL=sqlite:///data_storage/knowledge_base.db
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- DEBUG=${DEBUG:-false}
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./data_storage:/app/data_storage
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8000/health').raise_for_status()"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
deploy:
resources:
limits:
memory: 2G
# ── Celery worker (document indexing) ────────────────────────────────────
celery_worker:
build:
context: .
dockerfile: Dockerfile.backend
container_name: kb-celery-worker
command: celery -A src.worker.celery_app.celery_app worker --loglevel=info --concurrency=2
environment:
- DATABASE_URL=sqlite:///data_storage/knowledge_base.db
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
- ./data_storage:/app/data_storage # shared with backend (uploads + indices)
depends_on:
redis:
condition: service_healthy
backend:
condition: service_healthy
restart: unless-stopped
deploy:
resources:
limits:
memory: 2G # SentenceTransformer model needs ~500 MB; give headroom
# ── React frontend ────────────────────────────────────────────────────────
frontend:
build:
context: ./web
dockerfile: Dockerfile
container_name: kb-frontend
ports:
- "3000:3000"
environment:
- VITE_API_URL=http://localhost:8000
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
networks:
default:
name: kb-network
driver: bridge