version: '3.8'

services:
  # 后端 API
  backend:
    build:
      context: ../api
      dockerfile: Dockerfile
    ports:
      - "8100:8100"
    environment:
      - DATABASE_URL=sqlite:///./data/app.db
      - MINIO_ENDPOINT=minio:9000
      - MINIO_ACCESS_KEY=admin
      - MINIO_SECRET_KEY=password123
      - MINIO_BUCKET=ai-audio
    volumes:
      - ../api:/app
      - ../api/data:/app/data
    depends_on:
      - minio

  # 对话引擎 (py-active-call)
  engine:
    build:
      context: ../engine
      dockerfile: Dockerfile
    ports:
      - "8001:8001"
    environment:
      - BACKEND_URL=http://backend:8100
    depends_on:
      - backend

  # 前端 (Vite + React)
  frontend:
    build:
      context: ../web
      dockerfile: Dockerfile
      args:
        - VITE_API_BASE_URL=http://localhost:8100/api
    ports:
      - "6000:6000"
    depends_on:
      - backend

  # MinIO (S3 兼容存储)
  minio:
    image: minio/minio
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - ./storage/minio/data:/data
    environment:
      MINIO_ROOT_USER: admin
      MINIO_ROOT_PASSWORD: password123
    command: server /data --console-address ":9001"
