version: '3.8'

services:
  mengyaping-backend:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: mengyaping-backend
    restart: unless-stopped
    ports:
      - "6161:8080"
    volumes:
      # 持久化数据目录
      - /shumengya/docker/mengyaping-backend/data/:/app/data
    environment:
      # 服务器配置
      - SERVER_PORT=8080
      - SERVER_HOST=0.0.0.0
      # 监控配置
      - MONITOR_INTERVAL=5m
      - MONITOR_TIMEOUT=10s
      - MONITOR_RETRY_COUNT=3
      - MONITOR_HISTORY_DAYS=7
    networks:
      - mengyaping-network
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/health"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 5s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

networks:
  mengyaping-network:
    driver: bridge
