xiaozhi-esp32-server/main/xiaozhi-server/docker-compose_all.yml

98 lines
3 KiB
YAML

# Docker installation with all modules
version: '3'
services:
# Server module
xiaozhi-esp32-server:
build:
context: ../../
dockerfile: Dockerfile-server
container_name: xiaozhi-esp32-server
restart: always
security_opt:
- seccomp:unconfined
env_file:
- .env
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- VOICE_PRINT_URL=http://192.168.1.178:8005/voiceprint/health?key=39fd8c01-c868-4197-8308-f91893864d6a
- TZ=America/Sao_Paulo
ports:
- "8000:8000"
- "8003:8003"
volumes:
# Persistent data files and large model files only:
- ./data:/opt/xiaozhi-esp32-server/data
- ./models/SenseVoiceSmall/model.pt:/opt/xiaozhi-esp32-server/models/SenseVoiceSmall/model.pt
# (Optional) Allows real-time plugin editing without rebuilding the image after each change:
- ./plugins_func:/opt/xiaozhi-esp32-server/plugins_func
# Manager API and Manager Web
xiaozhi-esp32-server-web:
build:
context: ../../ # Project root directory (containing the 'main' and 'docs' directories)
dockerfile: Dockerfile-web # Dockerfile name (if located in the root directory) or relative path, e.g., docs/docker/Dockerfile
container_name: xiaozhi-esp32-server-web
restart: always
networks:
- default
depends_on:
xiaozhi-esp32-server-db:
condition: service_healthy
xiaozhi-esp32-server-redis:
condition: service_healthy
ports:
- "8002:8002"
environment:
- TZ=America/Sao_Paulo
- SPRING_DATASOURCE_DRUID_URL=jdbc:mysql://xiaozhi-esp32-server-db:3306/xiaozhi_esp32_server?useUnicode=true&characterEncoding=UTF-8&serverTimezone=America/Sao_Paulo&nullCatalogMeansCurrent=true&connectTimeout=30000&socketTimeout=30000&autoReconnect=true&failOverReadOnly=false&maxReconnects=10
- SPRING_DATASOURCE_DRUID_USERNAME=root
- SPRING_DATASOURCE_DRUID_PASSWORD=123456
- SPRING_DATA_REDIS_HOST=xiaozhi-esp32-server-redis
- SPRING_DATA_REDIS_PASSWORD=
- SPRING_DATA_REDIS_PORT=6379
volumes:
- ./uploadfile:/uploadfile
# Database module
xiaozhi-esp32-server-db:
image: mysql:latest
container_name: xiaozhi-esp32-server-db
healthcheck:
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
timeout: 45s
interval: 10s
retries: 10
restart: always
networks:
- default
ports:
- "3306:3306"
volumes:
- ./mysql/data:/var/lib/mysql
environment:
- TZ=America/Sao_Paulo
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=xiaozhi_esp32_server
- MYSQL_INITDB_ARGS="--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
# Redis module
xiaozhi-esp32-server-redis:
image: redis:8.0
expose:
- 6379
container_name: xiaozhi-esp32-server-redis
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
networks:
- default
networks:
default: