version: '3.8'

services:
  report-service:
    build:
      context: ../..
      dockerfile: services/report-service/src/main/resources/deployment/Dockerfile
    container_name: erp-report-service
    ports:
      - "8086:8086"
    environment:
      - SPRING_PROFILES_ACTIVE=dev
      - NACOS_SERVER_ADDR=nacos:8848
      - NACOS_NAMESPACE=public
      - NACOS_GROUP=DEFAULT_GROUP
      - PROFILE=dev
      - TZ=Asia/Shanghai
    volumes:
      - ./logs:/app/logs
      - /etc/localtime:/etc/localtime:ro
    networks:
      - erp-network
    healthcheck:
      test: ["CMD", "/app/health-check.sh"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    deploy:
      resources:
        limits:
          memory: 1G
        reservations:
          memory: 512M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3

  # 本地开发依赖服务（仅dev环境）
  mysql-report:
    image: mysql:8.0
    container_name: erp-report-mysql
    ports:
      - "3307:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=root123456
      - MYSQL_DATABASE=erp_report
      - TZ=Asia/Shanghai
    volumes:
      - mysql-report-data:/var/lib/mysql
    networks:
      - erp-network
    profiles:
      - dev

networks:
  erp-network:
    driver: bridge

volumes:
  mysql-report-data:
