xiaozhi-esp32-server/main/docker-compose_local_all.yml
2025-12-19 14:33:27 +08:00

132 lines
4.1 KiB
YAML

services:
# ============================================================================
# xiaozhi-server (Python WebSocket Server)
# ============================================================================
xiaozhi-esp32-server:
build:
context: ./xiaozhi-server/
dockerfile: Dockerfile
image: xiaozhi-esp32-server:local
container_name: xiaozhi-esp32-server
env_file:
- .env
depends_on:
live-agent-api:
condition: service_healthy
restart: unless-stopped
networks:
- xiaozhi-network
ports:
# WebSocket server
- "8000:8000"
# HTTP server for vision analysis and OTA
- "8003:8003"
security_opt:
- seccomp:unconfined
environment:
- TZ=Asia/Shanghai
- PYTHONUNBUFFERED=1
- LOG_LEVEL=INFO
- REGION=LOCAL
healthcheck:
disable: true
volumes:
# Configuration directory
- ./xiaozhi-server/data:/opt/xiaozhi-esp32-server/data
# Custom config (optional override, uncomment if you need to customize)
- ./xiaozhi-server/custom_config.yaml:/opt/xiaozhi-esp32-server/custom_config.yaml
# Model files (important!)
- ./xiaozhi-server/models/SenseVoiceSmall:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall
- ./xiaozhi-server/models/snakers4_silero-vad:/opt/xiaozhi-esp32-server/models/snakers4_silero-vad
- ./xiaozhi-server/models/fsmn_vad_onnx:/opt/xiaozhi-esp32-server/models/fsmn_vad_onnx
# Temporary files
- ./xiaozhi-server/tmp:/opt/xiaozhi-esp32-server/tmp
# Music files (optional)
- ./xiaozhi-server/music:/opt/xiaozhi-esp32-server/music
# Logs (optional, for debugging)
- ./xiaozhi-server/logs:/opt/xiaozhi-esp32-server/logs
# ============================================================================
# live-agent-api Services
# ============================================================================
live-agent-postgres:
image: postgres:16-alpine
container_name: live-agent-postgres
environment:
POSTGRES_DB: live_agent
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- ./live-agent-api/data/postgres:/var/lib/postgresql/data
- ./live-agent-api/init_db.sql:/docker-entrypoint-initdb.d/init_db.sql
networks:
- xiaozhi-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
live-agent-minio:
image: minio/minio:latest
container_name: live-agent-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "19000:9000"
- "19001:9001"
volumes:
- ./live-agent-api/data/minio:/data
networks:
- xiaozhi-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
live-agent-api:
build:
context: ./live-agent-api
dockerfile: Dockerfile
container_name: live-agent-api
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@live-agent-postgres:5432/live_agent
S3_ENDPOINT_URL: http://live-agent-minio:9000
DEBUG: "True"
ports:
- "8080:8080"
networks:
- xiaozhi-network
depends_on:
live-agent-postgres:
condition: service_healthy
live-agent-minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 5
# ============================================================================
# Networks
# ============================================================================
networks:
xiaozhi-network:
driver: bridge
name: xiaozhi-network
# ============================================================================
# Volumes (optional - for named volumes instead of bind mounts)
# ============================================================================
# volumes:
# mysql-data:
# redis-data: