version: '3.8'

services:
  purchase-service:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: purchase-service
    ports:
      - "8010:8010"
    environment:
      - SPRING_PROFILES_ACTIVE=dev
      - DB_HOST=111.229.80.149
      - DB_PORT=3306
      - DB_NAME=purchase_db
      - DB_USER=root
      - DB_PASSWORD=nihao588+
      - REDIS_HOST=111.229.80.149
      - REDIS_PORT=6379
      - REDIS_PASSWORD=Y(@r5tGk9$Lp2
      - NACOS_SERVER=127.0.0.1:8848
      - NACOS_NAMESPACE=public
      - SERVER_PORT=8010
      - JAVA_OPTS=-Xms512m -Xmx1024m
    networks:
      - erp-network
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:8010/actuator/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    restart: unless-stopped
    volumes:
      - ./logs:/app/logs
      - /etc/localtime:/etc/localtime:ro

networks:
  erp-network:
    driver: bridge
