142 lines
4.2 KiB
YAML
142 lines
4.2 KiB
YAML
# =============================================================================
|
|
# MinerU ROCm Docker Compose 配置
|
|
# 原生 Linux + AMD GPU 环境
|
|
# =============================================================================
|
|
|
|
services:
|
|
# --- WebUI 前端 ---
|
|
gradio:
|
|
image: mineru-rocm:7.2.1
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
network: host
|
|
args:
|
|
ARCH: ${ARCH:-gfx1201}
|
|
GIT_PROXY: ${GIT_PROXY:-}
|
|
container_name: mineru-gradio
|
|
stdin_open: true
|
|
tty: true
|
|
ipc: host
|
|
restart: on-failure:3
|
|
devices:
|
|
- /dev/kfd
|
|
- /dev/dri
|
|
security_opt:
|
|
- seccomp=unconfined
|
|
group_add:
|
|
- video
|
|
ports:
|
|
- "10002:7860"
|
|
environment:
|
|
- GRADIO_SERVER_NAME=0.0.0.0
|
|
- HIP_VISIBLE_DEVICES=${HIP_VISIBLE_DEVICES:-0}
|
|
- 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-gradio",
|
|
"--server-name", "0.0.0.0",
|
|
"--server-port", "7860",
|
|
]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:7860/ >/dev/null || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
# --- 可选:多 Worker API Router 模式(默认不启动)---
|
|
# 启用方式:docker compose --profile router-api up -d
|
|
# 单卡默认请使用上面的 gradio 服务;双卡时可在 .env 中设置 ROUTER_API_URLS。
|
|
worker0:
|
|
image: mineru-rocm:7.2.1
|
|
profiles: ["router-api"]
|
|
container_name: mineru-worker0
|
|
stdin_open: true
|
|
tty: true
|
|
ipc: host
|
|
restart: on-failure:3
|
|
devices:
|
|
- /dev/kfd
|
|
- /dev/dri
|
|
security_opt:
|
|
- seccomp=unconfined
|
|
group_add:
|
|
- video
|
|
environment:
|
|
- HIP_VISIBLE_DEVICES=0
|
|
- 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
|
|
profiles: ["dual-gpu"]
|
|
container_name: mineru-worker1
|
|
stdin_open: true
|
|
tty: true
|
|
ipc: host
|
|
restart: on-failure:3
|
|
devices:
|
|
- /dev/kfd
|
|
- /dev/dri
|
|
security_opt:
|
|
- seccomp=unconfined
|
|
group_add:
|
|
- video
|
|
environment:
|
|
- HIP_VISIBLE_DEVICES=1
|
|
- 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"]
|
|
|
|
router:
|
|
image: mineru-rocm:7.2.1
|
|
profiles: ["router-api"]
|
|
container_name: mineru-router
|
|
stdin_open: true
|
|
tty: true
|
|
ipc: host
|
|
restart: on-failure:3
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- MINERU_MODEL_SOURCE=${MINERU_MODEL_SOURCE:-huggingface}
|
|
volumes:
|
|
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
|
- ${OUTPUT_DIR:-./data/output}:/data/output
|
|
- ./scripts:/opt/scripts:ro
|
|
command:
|
|
[
|
|
"mineru-router",
|
|
"--api-urls",
|
|
"${ROUTER_API_URLS:-http://mineru-worker0:8001}",
|
|
"--host", "0.0.0.0",
|
|
"--port", "8000",
|
|
"--allow-public-http-client",
|
|
]
|
|
depends_on:
|
|
- worker0
|