-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
271 lines (258 loc) · 8.39 KB
/
Copy pathdocker-compose.yml
File metadata and controls
271 lines (258 loc) · 8.39 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: interview-agent-python
services:
mysql:
image: ${MYSQL_IMAGE:-mysql:8.4}
environment:
MYSQL_ROOT_PASSWORD: interview-root
MYSQL_DATABASE: interview_agent
MYSQL_USER: interview
MYSQL_PASSWORD: interview
TZ: Asia/Shanghai
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- "${MYSQL_PORT:-3307}:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uinterview", "-pinterview"]
interval: 10s
timeout: 5s
retries: 15
redis:
image: redis:7.4-alpine
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"]
ports:
- "${REDIS_PORT:-6381}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 15
etcd:
image: quay.io/coreos/etcd:v3.5.18
environment:
ETCD_AUTO_COMPACTION_MODE: revision
ETCD_AUTO_COMPACTION_RETENTION: "1000"
ETCD_QUOTA_BACKEND_BYTES: "4294967296"
ETCD_SNAPSHOT_COUNT: "50000"
command: >-
etcd --advertise-client-urls=http://127.0.0.1:2379
--listen-client-urls=http://0.0.0.0:2379 --data-dir=/etcd
volumes:
- etcd_data:/etcd
healthcheck:
test: ["CMD", "etcdctl", "endpoint", "health"]
interval: 10s
timeout: 5s
retries: 15
minio:
image: minio/minio:RELEASE.2024-12-18T13-15-44Z
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
command: minio server /data --console-address :9001
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 15
milvus:
image: milvusdb/milvus:v2.6.4
command: ["milvus", "run", "standalone"]
security_opt:
- seccomp:unconfined
environment:
ETCD_ENDPOINTS: etcd:2379
MINIO_ADDRESS: minio:9000
ports:
- "${MILVUS_PORT:-19531}:19530"
- "${MILVUS_HEALTH_PORT:-9093}:9091"
volumes:
- milvus_data:/var/lib/milvus
depends_on:
etcd:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
interval: 10s
timeout: 5s
retries: 30
embeddings:
# TEI currently publishes numbered x86_64 tags but only a rolling ARM64 tag.
# Pin the resolved ARM64 index digest; x86_64 users override TEI_IMAGE as documented.
image: ${TEI_IMAGE:-ghcr.io/huggingface/text-embeddings-inference@sha256:35c50d7494de22deecdb783b8f5b7e1d05765709bd90071b03469b9440d28656}
# BGE-M3 advertises an 8k context. TEI's default 16k-token warm-up batch can
# exceed Docker Desktop's memory limit on CPU/ARM64, so bound dynamic batches
# to the question-bank chunk size used by this service.
command:
- --model-id
- BAAI/bge-m3
- --port
- "80"
- --max-batch-tokens
- "1024"
- --max-batch-requests
- "8"
- --max-concurrent-requests
- "32"
ports:
- "8081:80"
volumes:
- hf_cache:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 20s
timeout: 10s
retries: 60
start_period: 60s
reranker-models:
# Install a pinned INT8 ONNX export so the multilingual reranker can coexist
# with BGE-M3 under an 8 GiB Docker Desktop memory limit.
image: ${TEI_IMAGE:-ghcr.io/huggingface/text-embeddings-inference@sha256:35c50d7494de22deecdb783b8f5b7e1d05765709bd90071b03469b9440d28656}
entrypoint: ["/bin/sh", "-ec"]
command:
- >-
base=https://huggingface.co/cross-encoder/mmarco-mMiniLMv2-L12-H384-v1/resolve/1427fd652930e4ba29e8149678df786c240d8825;
mkdir -p /models/onnx;
for file in config.json tokenizer.json tokenizer_config.json special_tokens_map.json; do
test -s /models/$${file} || curl -fL --retry 5 -o /models/$${file} $${base}/$${file};
done;
test -s /models/onnx/model.onnx || curl -fL --retry 5 -o /models/onnx/model.onnx $${base}/onnx/${RERANK_ONNX_FILE:-model_qint8_arm64.onnx};
test -s /models/onnx/model.onnx
volumes:
- reranker_models:/models
restart: "no"
reranker:
# Reuse the TEI runtime image; weights come from the pinned installer above.
image: ${TEI_IMAGE:-ghcr.io/huggingface/text-embeddings-inference@sha256:35c50d7494de22deecdb783b8f5b7e1d05765709bd90071b03469b9440d28656}
command:
- --model-id
- /models
- --port
- "80"
- --tokenization-workers
- "2"
- --max-batch-tokens
- "512"
- --max-batch-requests
- "1"
- --max-concurrent-requests
- "4"
ports:
- "${RERANK_PORT:-8082}:80"
volumes:
- reranker_models:/models:ro
depends_on:
reranker-models:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 20s
timeout: 10s
retries: 60
start_period: 60s
speech:
# One ARM64/AMD64 CPU image provides both local Whisper ASR and Kokoro TTS.
image: ${SPEACHES_IMAGE:-ghcr.io/speaches-ai/speaches@sha256:21e3df06d842fb7802ab470dd77c25f0e8c0d22950e8d8c6ae886e851af53ef8}
environment:
WHISPER__COMPUTE_TYPE: int8
WHISPER__CPU_THREADS: "4"
WHISPER__TTL: "60"
ports:
- "${SPEECH_PORT:-8002}:8000"
volumes:
# Speaches runs as a non-root user; use its own persistent cache so the
# root-owned TEI cache cannot cause permission errors.
- speech_hf_cache:/home/ubuntu/.cache/huggingface/hub
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 15s
timeout: 10s
retries: 60
start_period: 300s
speech-models:
# Reuse the exact Speaches image as a one-shot ASR model installer. Repeated
# starts are fast because the Whisper snapshot already exists in the volume.
image: ${SPEACHES_IMAGE:-ghcr.io/speaches-ai/speaches@sha256:21e3df06d842fb7802ab470dd77c25f0e8c0d22950e8d8c6ae886e851af53ef8}
entrypoint: ["/bin/sh", "-ec"]
command:
- >-
curl -fsS --retry 5 -X POST
http://speech:8000/v1/models/${SPEECH_TRANSCRIPTION_MODEL:-Systran/faster-whisper-base}
depends_on:
speech:
condition: service_healthy
restart: "no"
tts-models:
build: .
entrypoint: ["/bin/sh", "-ec"]
command:
- >-
if [ ! -s /models/sherpa-onnx-vits-zh-ll/model.onnx ]; then
curl -fL --retry 5 -o /models/sherpa-onnx-vits-zh-ll.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2;
tar -xjf /models/sherpa-onnx-vits-zh-ll.tar.bz2 -C /models;
rm /models/sherpa-onnx-vits-zh-ll.tar.bz2;
fi;
test -s /models/sherpa-onnx-vits-zh-ll/model.onnx;
test -s /models/sherpa-onnx-vits-zh-ll/lexicon.txt;
test -s /models/sherpa-onnx-vits-zh-ll/tokens.txt
volumes:
- tts_models:/models
restart: "no"
app:
profiles: ["app"]
build: .
env_file: .env
environment:
MYSQL_DSN: mysql+asyncmy://interview:interview@mysql:3306/interview_agent?charset=utf8mb4
REDIS_URL: redis://redis:6379/0
MILVUS_URI: http://milvus:19530
EMBEDDING_BASE_URL: http://embeddings:80
RERANK_BASE_URL: http://reranker:80
SPEECH_BASE_URL: http://speech:8000
TTS_MODEL_DIRECTORY: /models/sherpa-onnx-vits-zh-ll
ports:
- "${APP_PORT:-9092}:9090"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
milvus:
condition: service_healthy
embeddings:
condition: service_healthy
reranker:
condition: service_healthy
speech:
condition: service_healthy
speech-models:
condition: service_completed_successfully
tts-models:
condition: service_completed_successfully
volumes:
- tts_models:/models:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9090/health/ready"]
interval: 10s
timeout: 5s
retries: 20
start_period: 20s
volumes:
mysql_data:
redis_data:
etcd_data:
minio_data:
milvus_data:
hf_cache:
speech_hf_cache:
tts_models:
reranker_models: