version: '3.8'

services:
  report-service:
    build:
      context: .
      dockerfile: deploy/Dockerfile
    container_name: report-service
    restart: unless-stopped
    ports:
      - "8084:8084"
    environment:
      - SPRING_PROFILES_ACTIVE=prod
      - EXPORT_BASE_PATH=/data/exports
      - SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/erp_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
      - SPRING_DATASOURCE_USERNAME=root
      - SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD:-Admin1234}
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_REDIS_PASSWORD=${REDIS_PASSWORD:-Y(@r5tGk9$Lp2}
      - NACOS_HOST=nacos
      - NACOS_PORT=8848
      - JAVA_OPTS=-Xms512m -Xmx1024m -XX:+UseG1GC
    volumes:
      - /data/exports:/data/exports
      - /var/log/report-service:/var/log/report-service
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8084/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    networks:
      - erp-network
    depends_on:
      - mysql
      - redis
      - nacos

networks:
  erp-network:
    external: true
