version: '3.8'

services:
  # 应用服务（前端+后端）
  app:
    image: registry.cn-hangzhou.aliyuncs.com/yvan329/quanyoumi-app:0.0.2
    container_name: quanyoumi-app
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
      - PORT=3000
      # JWT 密钥（请修改为随机字符串）
      - JWT_SECRET=quanyoumi_jwt_secret_change_this_in_production_2024
      # 高德地图配置（必填）
      - AMAP_KEY=fd5b77136ba34fe6b4f0f86dca7782d9
      - AMAP_SECURITY_CODE=7f61638e5635d944a534ff747dc615ac
    volumes:
      - app-data:/app/data
      - app-uploads:/app/uploads
    networks:
      - quanyoumi-network
    healthcheck:
      test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/activities', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 10s

volumes:
  app-data:
    driver: local
  app-uploads:
    driver: local

networks:
  quanyoumi-network:
    driver: bridge
