version: '3.8'

# 用户管理系统 - Docker 部署配置
# 使用 SQLite 数据库，无需额外数据库服务
#
# 使用方法:
#   docker compose up -d        # 启动服务
#   docker compose logs -f      # 查看日志
#   docker compose down         # 停止服务
#
# 访问: http://localhost:8080

services:
  # 用户管理服务
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: user-management-app
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      # 持久化 SQLite 数据库
      - app-data:/app/data
      # 持久化日志
      - app-logs:/app/logs
    environment:
      - TZ=Asia/Shanghai
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: '0.5'
        reservations:
          memory: 256M
          cpus: '0.25'
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/api/v1/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    networks:
      - user-ms-network

volumes:
  app-data:
    driver: local
  app-logs:
    driver: local

networks:
  user-ms-network:
    driver: bridge

