Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
196 lines (185 loc) · 9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
196 lines (185 loc) · 9 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
195
196
# =============================================================================
# MeetBot — Optimized Docker Compose Configuration
#
# Architecture: two containers (backend + frontend) sharing a Docker network.
#
# Layer-cache strategy
# ─────────────────────
# • Backend: requirements.txt is copied and pip-installed BEFORE the source
# tree is copied. Only a requirements.txt change busts the dep layer.
# • Frontend: package.json / package-lock.json are copied and npm ci runs
# BEFORE the source tree is copied. Same benefit.
#
# Persistent storage strategy
# ─────────────────────────────
# bind mounts — user-facing directories that should be inspectable / editable
# from the host: data, db, results, models, temp, prepared
# named volumes — runtime caches that are managed entirely by Docker and have
# no need to appear in the project directory: hf_cache
#
# Quick start (CPU):
# docker compose up -d
#
# GPU (CUDA 11.8):
# CUDA_VARIANT=cu118 DEVICE=cuda EMBEDDING_DEVICE=cuda docker compose up -d
#
# GPU (CUDA 12.1):
# CUDA_VARIANT=cu121 DEVICE=cuda EMBEDDING_DEVICE=cuda docker compose up -d
#
# Rebuild after code change (deps layer stays cached):
# docker compose build meetbot
# docker compose up -d meetbot
#
# Full rebuild (bust all caches):
# docker compose build --no-cache
# =============================================================================
# ---------------------------------------------------------------------------
# Shared environment fragment — referenced by the meetbot service only.
# Using YAML anchors avoids repeating long env lists.
# ---------------------------------------------------------------------------
x-meetbot-env: &meetbot-env
# ── Web server ──────────────────────────────────────────────────────────
WEB_HOST: "0.0.0.0"
WEB_PORT: "8080"
WEB_SECRET_KEY: ${WEB_SECRET_KEY:-change-this-in-production}
WEB_STORAGE_SECRET: ${WEB_STORAGE_SECRET:-change-this-storage-secret}
# ── HuggingFace ─────────────────────────────────────────────────────────
# Required for Pyannote speaker diarization (gated model) and HF Inference API.
HF_API_TOKEN: ${HF_API_TOKEN:-}
# ── Transcription ───────────────────────────────────────────────────────
# 'local' → GPU Whisper (needs DEVICE=cuda and a CUDA build)
# 'huggingface' → HuggingFace Inference API (needs HF_API_TOKEN)
TRANSCRIPTION_BACKEND: ${TRANSCRIPTION_BACKEND:-huggingface}
# ── LLM backend ─────────────────────────────────────────────────────────
# 'true' → local AWQ via transformers + autoawq (needs LOCAL_LLM_MODEL_PATH)
# 'false' → HuggingFace Inference API (needs HF_API_TOKEN)
USE_LOCAL_LLM: ${USE_LOCAL_LLM:-false}
HF_MODEL: ${HF_MODEL:-deepseek-ai/DeepSeek-V3-0324}
HF_PROVIDER: ${HF_PROVIDER:-auto}
# ── Compute devices ─────────────────────────────────────────────────────
# CPU-only (default): leave both as 'cpu'.
# GPU: set DEVICE=cuda EMBEDDING_DEVICE=cuda in your .env
DEVICE: ${DEVICE:-cpu}
EMBEDDING_DEVICE: ${EMBEDDING_DEVICE:-cpu}
# ── Model paths (must match volume mounts below) ────────────────────────
EMBEDDING_MODEL: /app/models/all-MiniLM-L6-v2
LOCAL_LLM_MODEL_PATH: /app/models/qwen2.5-7B
# ── I/O paths (must match volume mounts below) ──────────────────────────
OUTPUT_DIR: /app/results
VECTOR_DB_PATH: /app/db/chroma
# DB_PATH puts the SQLite file inside /app/db/ so it is covered by the
# ./db bind mount and persists across container rebuilds.
DB_PATH: /app/db/meetbot.db
TEMP_DIR: /app/temp
PREPARED_DOCS_DIR: /app/prepared
# HuggingFace model download cache → named volume (no host directory needed)
CACHE_DIR: /app/.cache_hf
# ── PageIndex (optional LLM-based tree-search retrieval) ────────────────
# Set PAGEINDEX_ENABLED=true and supply an API key to activate.
# PAGEINDEX_OUTPUT_DIR maps inside /app/db so trees persist via the bind mount.
PAGEINDEX_ENABLED: ${PAGEINDEX_ENABLED:-false}
PAGEINDEX_AUTO_INDEX: ${PAGEINDEX_AUTO_INDEX:-false}
PAGEINDEX_LLM_BACKEND: ${PAGEINDEX_LLM_BACKEND:-openrouter}
PAGEINDEX_LLM_BASE_URL: ${PAGEINDEX_LLM_BASE_URL:-https://openrouter.ai/api/v1}
PAGEINDEX_LLM_MODEL: ${PAGEINDEX_LLM_MODEL:-qwen/qwen3-next-80b-a3b-instruct:free}
PAGEINDEX_LLM_API_KEY: ${PAGEINDEX_LLM_API_KEY:-}
PAGEINDEX_OUTPUT_DIR: /app/db/pageindex
services:
# ---------------------------------------------------------------------------
# Backend — Python / NiceGUI + FastAPI
# ---------------------------------------------------------------------------
meetbot:
build:
context: .
dockerfile: Dockerfile
args:
# CUDA_VARIANT: cpu | cu118 | cu121
# The Dockerfile copies requirements.txt and installs deps BEFORE
# copying application source, so rebuilding after a code-only change
# reuses the cached pip layer entirely.
CUDA_VARIANT: ${CUDA_VARIANT:-cpu}
container_name: meetbot-app
ports:
- "${WEB_PORT:-8080}:8080"
volumes:
# ── bind mounts: user-managed, inspectable from the host ────────────
- ./data:/app/data # Audio uploads (data/uploads/*.wav …)
- ./results:/app/results # Pipeline JSON outputs
- ./db:/app/db # ChromaDB vector store + SQLite DB
- ./prepared:/app/prepared # Intermediate JSONL before indexing
- ./temp:/app/temp # Transient pipeline working files
# Models are large; mount read-only so the container can't corrupt them.
- ./models:/app/models:ro
# ── named volume: Docker-managed HuggingFace model download cache ────
# Whisper / Pyannote weights are downloaded once and survive rebuilds.
- hf_cache:/app/.cache_hf
environment:
<<: *meetbot-env
# GPU access — requires nvidia-container-toolkit on the host.
# Remove (or comment out) this entire `deploy` block for CPU-only.
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "3"
healthcheck:
# The NiceGUI server is ready when it serves the root page.
# start_period is generous because the first run downloads ML models.
test: ["CMD", "curl", "-fsS", "http://localhost:8080/"]
interval: 30s
timeout: 10s
start_period: 120s
retries: 5
# ---------------------------------------------------------------------------
# Frontend — Next.js (standalone build)
# ---------------------------------------------------------------------------
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
# NEXT_PUBLIC_API_URL is baked into the JS bundle at build time.
# Default works for local use (browser → host → container port 8080).
# Override for remote / production deployments:
# NEXT_PUBLIC_API_URL=http://192.168.1.50:8080/api docker compose build
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8080/api}
container_name: meetbot-frontend
ports:
- "${FRONTEND_PORT:-3000}:3000"
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8080/api}
depends_on:
meetbot:
condition: service_healthy
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
# =============================================================================
# Named volumes
# =============================================================================
volumes:
# HuggingFace model download cache.
# Whisper (openai/whisper-large-v3) and Pyannote (pyannote/speaker-
# diarization-3.1) weights are downloaded on first run and stored here.
# The volume persists across `docker compose down` and full image rebuilds,
# so models are never re-downloaded unless you explicitly run:
# docker volume rm meetbot_hf_cache
hf_cache: