# 知习 本地开发环境 Docker Compose
# 只包含基础设施（MySQL/Redis/Qdrant），API/Worker/RAG Worker 在宿主机运行

services:
  mysql:
    image: mysql:8.0
    container_name: zhixi-mysql
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: Zhixi@2026!Root_8C
      MYSQL_DATABASE: zhixi_prod
    ports:
      - '3306:3306'
    volumes:
      - mysql_local:/var/lib/mysql
      - ./mysql.conf.d:/etc/mysql/conf.d:ro
    healthcheck:
      test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: zhixi-redis
    restart: unless-stopped
    ports:
      - '6379:6379'
    volumes:
      - redis_local:/data
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 10s
      timeout: 5s
      retries: 5

  qdrant:
    image: qdrant/qdrant:latest
    container_name: zhixi-qdrant
    restart: unless-stopped
    ports:
      - '6333:6333'
      - '6334:6334'
    volumes:
      - qdrant_local:/qdrant/storage
    # Qdrant image 不带 wget/curl，跳过 healthcheck

volumes:
  mysql_local:
  redis_local:
  qdrant_local:
