111 lines
3.4 KiB
YAML
111 lines
3.4 KiB
YAML
# =============================================================================
|
||
# MinerU ROCm Docker Compose 配置
|
||
# 原生 Linux + AMD GPU 环境
|
||
#
|
||
# 架构:Gradio / API → nginx (8000) → worker0 (8001) / worker1 (8002)
|
||
# =============================================================================
|
||
|
||
services:
|
||
# --- WebUI 前端(纯前端,通过 nginx 分发到 worker)---
|
||
gradio:
|
||
image: mineru-rocm:7.2.1
|
||
profiles: ["gradio"]
|
||
container_name: mineru-gradio
|
||
stdin_open: true
|
||
tty: true
|
||
ipc: host
|
||
ports:
|
||
- "10002:7860"
|
||
environment:
|
||
- GRADIO_SERVER_NAME=0.0.0.0
|
||
- GRADIO_TEMP_DIR=/tmp/gradio
|
||
- MINERU_API_BASE=http://mineru-nginx:8000
|
||
- MINERU_MODEL_SOURCE=${MINERU_MODEL_SOURCE:-huggingface}
|
||
- HF_HUB_CACHE=${HF_HUB_CACHE:-/opt/models/huggingface}
|
||
- MODELSCOPE_CACHE=${MODELSCOPE_CACHE:-/opt/models/modelscope}
|
||
volumes:
|
||
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||
- ./scripts:/opt/scripts:ro
|
||
command:
|
||
[
|
||
"/opt/mineru_venv/bin/python", "/opt/scripts/mineru_webui.py",
|
||
]
|
||
depends_on:
|
||
- nginx
|
||
|
||
# --- 双卡 Worker(GPU 算力)---
|
||
worker0:
|
||
image: mineru-rocm:7.2.1
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile
|
||
network: host
|
||
args:
|
||
ARCH: ${ARCH:-gfx1201}
|
||
GIT_PROXY: ${GIT_PROXY:-}
|
||
container_name: mineru-worker0
|
||
stdin_open: true
|
||
tty: true
|
||
ipc: host
|
||
devices:
|
||
- /dev/kfd
|
||
- /dev/dri
|
||
security_opt:
|
||
- seccomp=unconfined
|
||
group_add:
|
||
- video
|
||
environment:
|
||
- HIP_VISIBLE_DEVICES=0
|
||
- PYTHONPATH=/opt/vllm:${PYTHONPATH:-}
|
||
- MINERU_MODEL_SOURCE=${MINERU_MODEL_SOURCE:-huggingface}
|
||
- HF_HUB_CACHE=${HF_HUB_CACHE:-/opt/models/huggingface}
|
||
- MODELSCOPE_CACHE=${MODELSCOPE_CACHE:-/opt/models/modelscope}
|
||
volumes:
|
||
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||
- ${MIOPEN_CACHE:-./data/miopen}:/root/.cache/miopen
|
||
- ./scripts:/opt/scripts:ro
|
||
command: ["mineru-api", "--host", "0.0.0.0", "--port", "8001", "--allow-public-http-client"]
|
||
|
||
worker1:
|
||
image: mineru-rocm:7.2.1
|
||
container_name: mineru-worker1
|
||
stdin_open: true
|
||
tty: true
|
||
ipc: host
|
||
devices:
|
||
- /dev/kfd
|
||
- /dev/dri
|
||
security_opt:
|
||
- seccomp=unconfined
|
||
group_add:
|
||
- video
|
||
environment:
|
||
- HIP_VISIBLE_DEVICES=1
|
||
- PYTHONPATH=/opt/vllm:${PYTHONPATH:-}
|
||
- MINERU_MODEL_SOURCE=${MINERU_MODEL_SOURCE:-huggingface}
|
||
- HF_HUB_CACHE=${HF_HUB_CACHE:-/opt/models/huggingface}
|
||
- MODELSCOPE_CACHE=${MODELSCOPE_CACHE:-/opt/models/modelscope}
|
||
volumes:
|
||
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||
- ${MIOPEN_CACHE:-./data/miopen}:/root/.cache/miopen
|
||
- ./scripts:/opt/scripts:ro
|
||
command: ["mineru-api", "--host", "0.0.0.0", "--port", "8002", "--allow-public-http-client"]
|
||
|
||
# --- Nginx 负载均衡(替换有 Bug 的 mineru-router)---
|
||
nginx:
|
||
image: nginx:alpine
|
||
container_name: mineru-nginx
|
||
ports:
|
||
- "8000:8000"
|
||
volumes:
|
||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||
depends_on:
|
||
- worker0
|
||
- worker1
|