services:
  maestro:
    build:
      context: .
      dockerfile: Dockerfile
    image: maestro:latest
    container_name: maestro
    restart: unless-stopped
    ports:
      - "9876:9876"
    env_file:
      - .env
    environment:
      - NODE_ENV=production
      - PORT=9876
      - DB_PATH=/data/maestro.db
      - WORKTREE_DIR=/workspaces
    volumes:
      # SQLite DB 永続化
      - maestro-data:/data
      # エージェントワークスペース永続化
      - maestro-workspaces:/workspaces
      # 設定ファイル (任意でホストからマウント)
      # - ./config.yaml:/app/config.yaml:ro
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://localhost:9876/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

volumes:
  maestro-data:
    driver: local
  maestro-workspaces:
    driver: local
