# ===============================================
# Reconciliation Service Docker Compose
# 对账管理服务 Docker Compose配置
# ===============================================

version: '3.8'

services:
  reconciliation-service:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: erp-reconciliation-service
    restart: unless-stopped
    ports:
      - "8018:8018"
    environment:
      # Java环境
      JAVA_OPTS: "-Xms256m -Xmx512m -XX:+UseG1GC"
      # 数据库配置
      DB_HOST: ${DB_HOST:-111.229.80.149}
      DB_PORT: ${DB_PORT:-3306}
      DB_NAME: ${DB_NAME:-erp_db}
      DB_USERNAME: ${DB_USERNAME:-root}
      DB_PASSWORD: ${DB_PASSWORD:-nihao588+}
      # Nacos配置
      NACOS_SERVER_ADDR: ${NACOS_SERVER_ADDR:-127.0.0.1:8848}
      NACOS_NAMESPACE: ${NACOS_NAMESPACE:-public}
      # 日志级别
      LOG_LEVEL: ${LOG_LEVEL:-INFO}
      # 定时任务开关
      SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-dev}
    volumes:
      # 日志目录
      - ./logs:/app/logs
      # 时区配置
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    networks:
      - erp-network
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:8018/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    deploy:
      resources:
        limits:
          memory: 768M
        reservations:
          memory: 256M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3

networks:
  erp-network:
    external: true
    name: erp-network
