-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
89 lines (83 loc) · 2.84 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
89 lines (83 loc) · 2.84 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
version: '3.8'
services:
# ─────────────────────────────────────────────
# Frontend — React app served by nginx on :3000
# nginx also proxies /api/* → backend:8000
# ─────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: political-chatbot-frontend
ports:
- "3000:80"
depends_on:
- backend
networks:
- chatbot-network
restart: unless-stopped
# ─────────────────────────────────────────────
# Backend — FastAPI on :8000
# ─────────────────────────────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: political-chatbot-backend
ports:
- "8000:8000"
env_file:
- .env.docker
environment:
# Override just the Ollama host so it uses the Docker service name
OLLAMA_HOST: "http://ollama:11434"
CORS_ORIGINS: "http://localhost:3000,http://frontend:80"
depends_on:
- ollama
networks:
- chatbot-network
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# ─────────────────────────────────────────────
# Ollama — local LLM inference on :11434
# ─────────────────────────────────────────────
ollama:
image: ollama/ollama:latest
container_name: political-chatbot-ollama
ports:
- "11434:11434"
volumes:
- ollama-models:/root/.ollama
networks:
- chatbot-network
restart: unless-stopped
# Limit CPU so Ollama doesn't saturate the host during inference.
# 4.0 = up to 4 logical cores. Raise if responses feel too slow,
# lower further (e.g. 2.0) if the machine is still struggling.
deploy:
resources:
limits:
cpus: "4.0"
memory: 6G
environment:
# Keep only 1 model loaded in memory at a time
OLLAMA_MAX_LOADED_MODELS: "1"
# Limit parallel inference requests
OLLAMA_NUM_PARALLEL: "1"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
volumes:
ollama-models:
driver: local
networks:
chatbot-network:
driver: bridge