version: '3.8'

services:
  audit-log-service:
    build:
      context: ../..
      dockerfile: services/audit-log-service/Dockerfile
    container_name: erp-audit-log-service
    ports:
      - "8098:8098"
    environment:
      - SPRING_PROFILES_ACTIVE=docker
      - NACOS_SERVER_ADDR=nacos:8848
      - NACOS_NAMESPACE=${NACOS_NAMESPACE:-public}
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_NAME=erp_java
      - DB_USERNAME=erp_user
      - DB_PASSWORD=erp123456
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_PASSWORD=redis123456
      - JAVA_OPTS=-Xms256m -Xmx512m -XX:+UseG1GC
    volumes:
      - audit_logs:/app/logs
    networks:
      - erp-network
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8098/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    restart: unless-stopped
    depends_on:
      mysql:
        condition: service_healthy
      redis:
        condition: service_started
      nacos:
        condition: service_started

volumes:
  audit_logs:

networks:
  erp-network:
    external: true
