services:
  aivideo:
    build: .
    working_dir: /app
    depends_on:
      - comfyui
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}
      - OPENAI_BASE_URL=${OPENAI_BASE_URL:-}
      - PORT=3000
    volumes:
      - ./:/app
    ports:
      - "3000:3000"

  # Default: Docker Hub (anonymous pull). GHCR comfyanonymous image often returns "denied" without login.
  # Override: COMFYUI_IMAGE=ghcr.io/... after `docker login ghcr.io`
  comfyui:
    # CPU-friendly default image for non-NVIDIA development machines.
    # Override with COMFYUI_IMAGE to switch back to a GPU image.
    image: ${COMFYUI_IMAGE:-ardenius/comfyui-cpu:latest}
    # Force bind to all interfaces so other containers (and `check_comfy`) can reach it.
    # Works with the default ardenius/comfyui-cpu image layout (/ComfyUI-cpu/main.py).
    command: ${COMFYUI_COMMAND:-python3 /ComfyUI-cpu/main.py --cpu --cpu-vae --listen 0.0.0.0 --port 8188}
    ports:
      - "8188:8188"
