-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
194 lines (183 loc) · 5.66 KB
/
Copy pathdocker-compose.yml
File metadata and controls
194 lines (183 loc) · 5.66 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Copyright (c) 2025 Phillip-Juan van der Berg. All Rights Reserved.
# Licensed under the PolyForm Noncommercial License 1.0.0.
# For commercial use, contact: bt1phillip@gmail.com
# Council - Multi-LLM Decision Board
# Docker Compose configuration for production and development
#
# Usage:
# Production: docker compose up -d
# Development: docker compose --profile dev up
# With Ollama: docker compose --profile ollama up -d
#
# Prerequisites:
# 1. Copy .env.example to .env
# 2. Add your API keys to .env
services:
# ==========================================================================
# DATABASE SERVICE
# ==========================================================================
db:
image: python:3.11-slim
container_name: council-db
volumes:
- council_db_data:/data
networks:
- council_network
# SQLite runs embedded in backend, this container just holds the volume
# and ensures data persistence. It stays idle.
command: tail -f /dev/null
restart: unless-stopped
# ==========================================================================
# BACKEND SERVICE
# ==========================================================================
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: ${BUILD_TARGET:-production}
container_name: council-backend
ports:
- "${BACKEND_PORT:-8888}:8000"
environment:
- PYTHONUNBUFFERED=1
- DATABASE_URL=sqlite:///./data/council.db
# Ollama connection (if using local LLM)
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}
env_file:
- .env
volumes:
- council_db_data:/app/data
- ./logs:/app/logs
networks:
- council_network
depends_on:
- db
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
restart: unless-stopped
# ==========================================================================
# FRONTEND SERVICE
# ==========================================================================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: ${BUILD_TARGET:-production}
container_name: council-frontend
ports:
- "${FRONTEND_PORT:-4000}:80"
environment:
- VITE_API_URL=${VITE_API_URL:-http://localhost:8888}
depends_on:
backend:
condition: service_healthy
networks:
- council_network
restart: unless-stopped
# ==========================================================================
# DEVELOPMENT SERVICES (use --profile dev)
# ==========================================================================
backend-dev:
build:
context: ./backend
dockerfile: Dockerfile.dev
container_name: council-backend-dev
profiles: ["dev"]
ports:
- "${BACKEND_PORT:-8888}:8000"
environment:
- PYTHONUNBUFFERED=1
- DATABASE_URL=sqlite:///./data/council.db
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://host.docker.internal:11434}
env_file:
- .env
volumes:
# Mount source for hot-reload
- ./backend:/app
- council_db_data:/app/data
- ./logs:/app/logs
# Exclude these from mount
- /app/__pycache__
- /app/.pytest_cache
networks:
- council_network
depends_on:
- db
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
frontend-dev:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: council-frontend-dev
profiles: ["dev"]
ports:
- "${FRONTEND_PORT:-4000}:5173"
environment:
- VITE_API_URL=http://localhost:8888
volumes:
# Mount source for hot-reload
- ./frontend:/app
- /app/node_modules
networks:
- council_network
command: npm run dev -- --host 0.0.0.0
# ==========================================================================
# OLLAMA SERVICE (use --profile ollama for bundled local LLM)
# ==========================================================================
ollama:
image: ollama/ollama:latest
container_name: council-ollama
profiles: ["ollama"]
ports:
- "${OLLAMA_PORT:-11435}:11434"
volumes:
- ollama_data:/root/.ollama
networks:
- council_network
# GPU support (uncomment if you have NVIDIA GPU)
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# ==========================================================================
# REDIS CACHE (optional, for session state in clustered deployments)
# ==========================================================================
redis:
image: redis:7-alpine
container_name: council-redis
profiles: ["cache"]
ports:
- "${REDIS_PORT:-6380}:6379"
volumes:
- redis_data:/data
networks:
- council_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
networks:
council_network:
name: council
driver: bridge
volumes:
ollama_data:
driver: local
redis_data:
driver: local
council_db_data:
driver: local