services:
  backend:
    build: ./backend
    container_name: deepseek-ocr-backend
    env_file:
      - .env
    environment:
      MODEL_NAME: ${MODEL_NAME:-deepseek-ai/DeepSeek-OCR}
      HF_HOME: ${HF_HOME:-/models}
      API_HOST: ${API_HOST:-0.0.0.0}
      API_PORT: ${API_PORT:-8000}
      MAX_UPLOAD_SIZE_MB: ${MAX_UPLOAD_SIZE_MB:-100}
    volumes:
      - ./models:/models
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    shm_size: "4g"
    ports:
      - "${API_PORT:-8000}:${API_PORT:-8000}"
    networks:
      - ocr-network

  frontend:
    build: ./frontend
    container_name: deepseek-ocr-frontend
    ports:
      - "${FRONTEND_PORT:-3000}:80"
    depends_on:
      - backend
    networks:
      - ocr-network

networks:
  ocr-network:
    driver: bridge
