# CloudSearch v2.3.0 — 单容器部署（全功能集成）
networks:
  cloudsearch-net:
    driver: bridge

volumes:
  admin-data:
  app-data:
  pansou-data:
  redis-data:

x-logging: &default-logging
  driver: json-file
  options:
    max-size: "50m"
    max-file: "10"

services:
  # ============ Redis ============
  redis:
    container_name: CloudSearch_Redis
    image: redis:7-alpine
    command: redis-server --save 60 1 --appendonly yes
    volumes:
      - redis-data:/data
    restart: always
    networks:
      - cloudsearch-net
    logging: *default-logging

  # ============ 全功能主应用 ============
  app:
    container_name: CloudSearch_App
    image: cloudsearch-app:v0.2.6
    ports:
      - "9527:9527"
    environment:
      - NODE_ENV=production
      - CORS_ORIGIN=http://jp-cs.timaa.cn
      - JWT_SECRET=u-_1wBd1IlQNYwZ9l5P1838x2fdsp0DI-BUhMouJeIg
      - ADMIN_PASSWORD=0nL5kLhMIJ1121PYmQb25A
      - PANSOU_URL=http://pansou:80
      - DB_PATH=/data/database.sqlite
      - REDIS_URL=redis://:redis_GbR7XZ@1Panel-redis-aDp3:6379
      - CLOUDSEARCH_API=http://localhost:9527
      - TRANSFER_CONFIG_PATH=/data/transfer_config.json
      - TZ=Asia/Shanghai
      - APP_VERSION_FILE=/data/VERSION
      - FEISHU_APP_ID=${FEISHU_APP_ID:-}
      - FEISHU_APP_SECRET=${FEISHU_APP_SECRET:-}
      - FEISHU_VERIFY_TOKEN=${FEISHU_VERIFY_TOKEN:-}
      - FEISHU_WEBHOOK_URL=${FEISHU_WEBHOOK_URL:-}
      - TMDB_API_KEY=${TMDB_API_KEY:-}
    volumes:
      - app-data:/data
      - ./uploads:/app/uploads
      - ./icons:/app/dist/frontend/admin/icons
      - ./VERSION:/data/VERSION
    depends_on:
    
  # ============ 管理后台 (功能开关) ============
  admin:
    container_name: CloudSearch_Admin
    image: cloudsearch-admin:v0.1.0
    ports:
      - "127.0.0.1:9531:9531"
    environment:
      - ADMIN_PORT=9531
      - ADMIN_PASSWORD=0nL5kLhMIJ1121PYmQb25A
      - ADMIN_DB_PATH=/data/admin_flags.sqlite
    volumes:
      - admin-data:/data
    restart: always
    networks:
      - cloudsearch-net
    logging: *default-logging

  pansou:
        condition: service_started
      redis:
        condition: service_started
    restart: always
    networks:
      - cloudsearch-net
    logging: *default-logging


  # ============ 管理后台 (功能开关) ============
  admin:
    container_name: CloudSearch_Admin
    image: cloudsearch-admin:v0.1.0
    ports:
      - "127.0.0.1:9531:9531"
    environment:
      - ADMIN_PORT=9531
      - ADMIN_PASSWORD=0nL5kLhMIJ1121PYmQb25A
      - ADMIN_DB_PATH=/data/admin_flags.sqlite
    volumes:
      - admin-data:/data
    restart: always
    networks:
      - cloudsearch-net
    logging: *default-logging

  pansou:
    container_name: CloudSearch_PanSou
    image: ghcr.io/fish2018/pansou-web:latest
    expose:
      - "80"
    environment:
      - DOMAIN=${DOMAIN:-localhost}
      - CACHE_TTL=60
    volumes:
      - pansou-data:/app/data
    restart: always
    networks:
      - cloudsearch-net
    logging: *default-logging

