version: "3.8"

services:
  jarvis-backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: jarvis-backend
    restart: unless-stopped
    ports:
      - "8000:8000"
    volumes:
      - ./data:/data/jarvis
    env_file:
      - ./backend/.env
    environment:
      - DATA_DIR=/data/jarvis/data
      - CHROMA_PERSIST_DIR=/data/jarvis/chroma
      - UPLOAD_DIR=/data/jarvis/uploads
      - NAS_DATA_ROOT=/data/jarvis
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/api/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  # 前端开发服务器（可选，生产环境用 nginx）
  jarvis-frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: jarvis-frontend
    restart: unless-stopped
    ports:
      - "5173:80"
    depends_on:
      - jarvis-backend
