name: cloudsearch
services:
  app:
    image: gitea.timxx.cn/admin/cloudsearch:latest
    container_name: CloudSearch_App
    restart: unless-stopped
    ports: ["9527:9527"]
    environment:
      REDIS_URL: ${REDIS_URL}
      PANSOU_URL: http://pansou:8888
      CORS_ORIGIN: ${CORS_ORIGIN:-https://zy.hk.timxx.cn}
      JWT_SECRET: ${JWT_SECRET:-cloudsearch-jwt-secret-2024}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD:-0nL5kLhMIJ1121PYmQb25A}
      LOG_LEVEL: ${LOG_LEVEL:-info}
    volumes: ["cloudsearch-data:/app/data"]
    depends_on: [pansou]
    networks: [cloudsearch-net]

  pansou:
    image: ghcr.io/fish2018/pansou-web:latest
    container_name: CloudSearch_PanSou
    restart: unless-stopped
    networks:
      cloudsearch-net: { aliases: [pansou] }

  # Redis — 仅当系统没有现成 Redis 时才启动
  redis:
    image: redis:7-alpine
    container_name: CloudSearch_Redis
    restart: unless-stopped
    command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
    volumes: ["redis-data:/data"]
    networks: [cloudsearch-net]
    profiles: [full]

volumes:
  cloudsearch-data:
  redis-data:

networks:
  cloudsearch-net:
    driver: bridge
