version: '3.8'

services:
  file-service:
    build:
      context: ..
      dockerfile: deploy/docker/Dockerfile
    container_name: erp-file-service
    ports:
      - "8082:8082"
    environment:
      - SPRING_PROFILES_ACTIVE=docker
      - 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=nihao588+
      - SPRING_DATA_REDIS_HOST=redis
      - SPRING_DATA_REDIS_PORT=6379
      - SPRING_DATA_REDIS_PASSWORD=Y(@r5tGk9$Lp2
      - SPRING_CLOUD_NACOS_SERVER=127.0.0.1:8848
      - FILE_STORAGE_DEFAULT=local
      - FILE_STORAGE_LOCAL_BASE_PATH=/var/erp/uploads
      - FILE_STORAGE_LOCAL_BASE_URL=http://localhost:8082/files
      - NACOS_SERVER=127.0.0.1:8848
    volumes:
      - file-uploads:/var/erp/uploads
      - ./logs:/app/logs
    networks:
      - erp-network
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8082/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s

volumes:
  file-uploads:
    driver: local

networks:
  erp-network:
    external: true
