services:
  backend:
    build:
      context: .
      dockerfile: docker/backend/Dockerfile
    container_name: ccdi-backend
    restart: unless-stopped
    environment:
      SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-nas}
      RUOYI_PROFILE: ${RUOYI_PROFILE:-/app/data/ruoyi}
      JAVA_OPTS: ${JAVA_OPTS:--Xms512m -Xmx1024m}
    ports:
      - "${BACKEND_PORT:-62318}:8080"
      - "${LSFX_MOCK_PORT:-62320}:8000"
    volumes:
      - ./runtime/ruoyi:/app/data/ruoyi
      - ./runtime/logs/backend:/app/logs

  lsfx-mock-server:
    build:
      context: .
      dockerfile: docker/mock/Dockerfile
    container_name: ccdi-lsfx-mock
    command: ["python", "main.py", "--rule-hit-mode", "subset"]
    restart: unless-stopped
    depends_on:
      - backend
    network_mode: "service:backend"
    environment:
      APP_NAME: 流水分析Mock服务
      APP_VERSION: 1.0.0
      DEBUG: "false"
      HOST: 0.0.0.0
      PORT: 8000
      PARSE_DELAY_SECONDS: 4
      CCDI_DB_HOST: ${CCDI_DB_HOST:-192.168.0.111}
      CCDI_DB_PORT: ${CCDI_DB_PORT:-40627}
      CCDI_DB_NAME: ${CCDI_DB_NAME:-ccdi}
      CCDI_DB_USERNAME: ${CCDI_DB_USERNAME:-root}
      CCDI_DB_PASSWORD: ${CCDI_DB_PASSWORD:-Kfcx@1234}

  frontend:
    build:
      context: .
      dockerfile: docker/frontend/Dockerfile
    container_name: ccdi-frontend
    restart: unless-stopped
    depends_on:
      - backend
    ports:
      - "${FRONTEND_PORT:-62319}:80"
