nex_animation/docker-compose.yml

96 lines
3.1 KiB
YAML
Raw Normal View History

2026-11-01 08:18:07 +00:00
services:
db:
image: postgres:17
environment:
POSTGRES_DB: ${POSTGRES_DB:-nexanimation}
POSTGRES_USER: ${POSTGRES_USER:-nex}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change_this_password}
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nex} -d ${POSTGRES_DB:-nexanimation}"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
volumes: [redis_data:/data]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
restart: unless-stopped
api:
build: ./backend
env_file: .env
environment:
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-nex}:${POSTGRES_PASSWORD:-change_this_password}@db:5432/${POSTGRES_DB:-nexanimation}
REDIS_URL: redis://redis:6379/0
MEDIA_ROOT: /app/media
TASK_EXECUTOR: celery
volumes: [media_data:/app/media]
ports: ["8000:8000"]
depends_on:
db: {condition: service_healthy}
redis: {condition: service_healthy}
restart: unless-stopped
worker:
build: ./backend
command: celery -A app.worker.celery_app worker -Q generate,audio,qc,compose,io,default --loglevel=INFO --concurrency=${CELERY_CONCURRENCY:-2}
env_file: .env
environment:
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-nex}:${POSTGRES_PASSWORD:-change_this_password}@db:5432/${POSTGRES_DB:-nexanimation}
REDIS_URL: redis://redis:6379/0
MEDIA_ROOT: /app/media
TASK_EXECUTOR: celery
volumes: [media_data:/app/media]
depends_on:
db: {condition: service_healthy}
redis: {condition: service_healthy}
restart: unless-stopped
beat:
build: ./backend
command: celery -A app.worker.celery_app beat --loglevel=INFO
env_file: .env
environment:
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-nex}:${POSTGRES_PASSWORD:-change_this_password}@db:5432/${POSTGRES_DB:-nexanimation}
REDIS_URL: redis://redis:6379/0
MEDIA_ROOT: /app/media
TASK_EXECUTOR: celery
volumes: [media_data:/app/media]
depends_on:
db: {condition: service_healthy}
redis: {condition: service_healthy}
restart: unless-stopped
web:
build: ./frontend
ports: ["8080:80"]
depends_on: [api]
restart: unless-stopped
# 自建 ComfyUI(可选):`docker compose --profile comfy up -d` 起一份本地实例。
# 已有外部 GPU 机器(如 http://10.100.53.199:9200)时不用开这个,
# 只在 .env 里写 COMFYUI_BASE_URL 指过去即可。
comfyui:
profiles: ["comfy"]
image: comfyanonymous/comfyui:latest
ports: ["9200:8188"]
volumes:
- comfy_models:/root/comfy-ui/models
- comfy_input:/root/comfy-ui/user/default
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
restart: unless-stopped
volumes:
postgres_data:
redis_data:
media_data:
comfy_models:
comfy_input: