version: "3.8" services: njupt-mcp: build: context: . dockerfile: Dockerfile image: njupt-mcp:latest container_name: njupt-mcp-server # 端口映射(主机端口:容器端口) ports: - "8000:8000" # 环境变量 environment: # 课表 HTML 文件路径(容器内路径) - COURSE_SCHEDULE=/app/data/course_schedule.html # 可选:调试模式 # - DEBUG=1 # 数据卷挂载(将主机上的课表文件映射到容器) volumes: # 挂载课表文件(请确保路径正确) - ./src/njupt_mcp/resources/course_schedule/B240423-22.html:/app/data/course_schedule.html:ro # 可选:挂载日志目录 - ./logs:/app/logs # 重启策略 restart: unless-stopped # 资源限制 deploy: resources: limits: cpus: '1.0' memory: 512M reservations: cpus: '0.25' memory: 128M # 健康检查 healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/sse')"] interval: 30s timeout: 10s retries: 3 start_period: 5s # 可选:使用已有网络 # networks: # default: # external: # name: my-network