# JuYouAI Windows 本地开发环境，提供 PostgreSQL 与 Redis 基础服务。
# Go API 直接在 Windows 运行，通过下方映射端口连接容器。
# 首次启动：
#   cd D:\Project\JuYouAI
#   docker compose up -d --wait


services:
  postgres:
    image: postgres:16-alpine
    container_name: juyouai-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: juyou_ai_app
      POSTGRES_PASSWORD: V7mQ2xN9kR4pT8wC6yH3sF5dL1zB0uGJqE9aK4nX2vP
      POSTGRES_DB: juyou_ai_prod
      TZ: Asia/Shanghai
      PGTZ: Asia/Shanghai
    ports:
      - "127.0.0.1:25432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - juyouai-network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U juyou_ai_app -d juyou_ai_prod"]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: juyouai-redis
    restart: unless-stopped
    command: ["redis-server", "--appendonly", "yes"]
    ports:
      - "127.0.0.1:26379:6379"
    volumes:
      - redis_data:/data
    networks:
      - juyouai-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  postgres_data:
  redis_data:

networks:
  juyouai-network:
    driver: bridge
