| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- services:
- mineru-api:
- image: mineru:latest
- container_name: mineru-api
- restart: always
- profiles: ["api"]
- ports:
- - 8000:8000
- environment:
- #MINERU_MODEL_SOURCE: local
- # 模型源:与 --source modelscope 保持一致
- - MINERU_MODEL_SOURCE=modelscope
- # 模型缓存路径(容器内)
- - MODELSCOPE_CACHE=/root/.cache/modelscope
- - MINERU_CACHE_DIR=/root/.cache/mineru
- # Transformers/HF 缓存,避免路径冲突
- - TRANSFORMERS_CACHE=/root/.cache/huggingface/transformers
- - HF_HOME=/root/.cache/huggingface
- # 日志与语言
- - LOG_DIR=/app/logs
- - LANG=zh_CN.UTF-8
- - PYTHONUNBUFFERED=1
- - DEVICE=cuda
- # API Key 配置(根据实际版本选择)
- - MINERU_API_KEY=sk_dev_aC_2gg8BS5ImUScrpaHIKS5x6gdLO9Js_ba854894
- entrypoint: mineru-api
- command:
- --host 0.0.0.0
- --port 8000
- # --allow-public-http-client # Disabled by default; when binding to 0.0.0.0 or ::, this re-enables *-http-client backends and server_url. Enable only if you accept the SSRF risk.
- # parameters for vllm-engine
- # --gpu-memory-utilization 0.5 # If encountering VRAM shortage, reduce the KV cache size by this parameter; if VRAM issues persist, try lowering it further to `0.4` or below.
- volumes:
- # 1. 模型缓存持久化 (核心:避免重复下载)
- - /home/ubuntu/.cache/modelscope:/root/.cache/modelscope:rw
- # 2. MinerU 缓存持久化
- - /home/ubuntu/.cache/mineru:/root/.cache/mineru:rw
- - /home/ubuntu/.cache/huggingface:/root/.cache/huggingface:rw # 新增:避免 transformers 缓存冲突
- # 3. 日志目录映射
- - //home/ubuntu/lq_workspace/minerU/logs:/app/logs:rw
- # 4. 输入文件目录 (可选,如果 API 支持文件上传处理)
- - /home/ubuntu/lq_workspace/minerU/input:/app/input:ro
- # 5. 输出结果目录 (可选)
- - /home/ubuntu/lq_workspace/minerU/output:/app/output:rw
- # 6. 配置文件目录 (可选,如有自定义配置)
- - /home/ubuntu/lq_workspace/minerU/config:/app/config:ro
-
- ulimits:
- memlock: -1
- stack: 67108864
- ipc: host
- healthcheck:
- test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
- networks:
- - lq_network
- deploy:
- resources:
- reservations:
- devices:
- - driver: nvidia
- device_ids: ["0"] # Modify for multiple GPUs: ["0", "1"]
- capabilities: [gpu]
- networks:
- lq_network:
- external: true
|