57 lines
2.0 KiB
YAML
57 lines
2.0 KiB
YAML
# 会会数字分身 —— Docker 测试实例(独立端口,不干扰现有 :8088 huihui 部署)
|
|
services:
|
|
avatar-backend:
|
|
build:
|
|
context: ./backend
|
|
args:
|
|
APP_GIT_SHA: ${APP_GIT_SHA:?APP_GIT_SHA must be the full release commit}
|
|
APP_BUILD_TIME: ${APP_BUILD_TIME:?APP_BUILD_TIME must be set}
|
|
image: avatar-test-backend:${APP_GIT_SHA}
|
|
container_name: avatar-test-backend
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: sqlite:////data/db/avatar.db
|
|
UPLOAD_DIR: /data/uploads
|
|
CHAT_MODEL_CONFIG_URL: http://host.docker.internal:8000/api/ai-models/runtime/digital-avatar
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
volumes:
|
|
# Mount the directory, not only avatar.db: SQLite WAL/SHM files must survive recreation.
|
|
- ${AVATAR_DB_DIR:?AVATAR_DB_DIR must contain the persistent avatar.db}:/data/db
|
|
- ${AVATAR_UPLOAD_DIR:?AVATAR_UPLOAD_DIR must point to persistent uploads}:/data/uploads
|
|
expose:
|
|
- "8000"
|
|
ports:
|
|
- "8011:8000" # 仅用于直接调试 API;前端经内部网络访问,不走 host 端口
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import json,urllib.request; d=json.load(urllib.request.urlopen('http://127.0.0.1:8000/api/health', timeout=5))['data']; assert d['status']=='ok' and all(d['checks'].values())"]
|
|
interval: 10s
|
|
timeout: 8s
|
|
retries: 12
|
|
start_period: 20s
|
|
networks:
|
|
- avatar-net
|
|
|
|
avatar-frontend:
|
|
build:
|
|
context: .
|
|
args:
|
|
APP_GIT_SHA: ${APP_GIT_SHA:?APP_GIT_SHA must be the full release commit}
|
|
APP_BUILD_TIME: ${APP_BUILD_TIME:?APP_BUILD_TIME must be set}
|
|
image: avatar-test-frontend:${APP_GIT_SHA}
|
|
container_name: avatar-test-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8099:80" # 浏览器访问 http://<host>:8099
|
|
depends_on:
|
|
avatar-backend:
|
|
condition: service_healthy
|
|
networks:
|
|
- avatar-net
|
|
|
|
networks:
|
|
avatar-net:
|
|
driver: bridge
|