Files
md-vector-db/docker-compose.yml

67 lines
1.9 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# docker-compose.yml — md-vector-db 本地开发与生产部署
version: "3.8"
services:
md-vector-db:
build:
context: .
dockerfile: Dockerfile
image: md-vector-db:latest
container_name: md-vector-db
restart: unless-stopped
ports:
- "${MD_VECTOR_PORT:-8000}:8000"
volumes:
# 持久化 ChromaDB 数据
- ./data:/app/data
# 挂载配置文件
- ./config.yaml:/app/config.yaml:ro
# 挂载待入库文档目录
- ${MD_VECTOR_DOCS_DIR:-./md_docs}:/app/md_docs:ro
environment:
- MD_VECTOR_CONFIG=/app/config.yaml
- MD_VECTOR_DB_DATA_DIR=/app/data
- MD_VECTOR_API_KEY=${MD_VECTOR_API_KEY:-}
- EMBED_API_KEY=${EMBED_API_KEY:-}
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000}
- MAX_REQUEST_BODY_SIZE=${MAX_REQUEST_BODY_SIZE:-10485760}
env_file:
- .env
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/v1/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# 可选:GPU 版本(需 nvidia-container-toolkit
md-vector-db-gpu:
profiles: ["gpu"]
build:
context: .
dockerfile: Dockerfile
image: md-vector-db:latest
container_name: md-vector-db-gpu
restart: unless-stopped
ports:
- "${MD_VECTOR_PORT:-8000}:8000"
volumes:
- ./data:/app/data
- ./config.yaml:/app/config.yaml:ro
- ${MD_VECTOR_DOCS_DIR:-./md_docs}:/app/md_docs:ro
environment:
- MD_VECTOR_CONFIG=/app/config.yaml
- MD_VECTOR_DB_DATA_DIR=/app/data
- MD_VECTOR_API_KEY=${MD_VECTOR_API_KEY:-}
- EMBED_API_KEY=${EMBED_API_KEY:-}
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000}
env_file:
- .env
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]