version: '3.8'

services:
  # FastAPI 后端
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: ordersys-backend
    restart: unless-stopped
    environment:
      DATABASE_URL: sqlite+aiosqlite:///./ordersys.db
      SHARED_INBOX_DIR: /app/uploads
      AUTO_SCHEDULE_ENABLED: "true"
      IMPORT_INTERVAL_MINUTES: ${IMPORT_INTERVAL_MINUTES:-10}
      TZ: Asia/Shanghai
    volumes:
      - ./uploads:/app/uploads
      - ./logs:/app/logs
      - ./backend/ordersys.db:/app/ordersys.db
    networks:
      - ordersys-network

  # Nginx 前端
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: ordersys-frontend
    restart: unless-stopped
    depends_on:
      - backend
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./ssl:/etc/nginx/ssl:ro
    networks:
      - ordersys-network

networks:
  ordersys-network:
    name: ordersys-network
    driver: bridge
