This commit is contained in:
2026-06-12 10:13:44 +08:00
parent 4f2b37b7b5
commit b962f0b6c0
3 changed files with 17 additions and 7 deletions
+4 -3
View File
@@ -303,14 +303,15 @@ RUN set -ex && \
# ===========================================================================
RUN set -ex && \
export http_proxy=${GIT_PROXY} https_proxy=${GIT_PROXY} && \
${VENV}/bin/pip install 'mineru[core]' && \
${VENV}/bin/python -c "import torch; import vllm; import mineru; print('MinerU OK')"
${VENV}/bin/pip install 'mineru[core]' click gradio && \
${VENV}/bin/python -c "import torch; import vllm; import mineru; import click; import gradio; import mineru.cli.gradio_app; print('MinerU + Gradio CLI imports OK')" && \
${VENV}/bin/mineru-gradio --help >/dev/null
# ===========================================================================
# 阶段 10:入口与最终验证
# ===========================================================================
RUN echo 'source /opt/mineru_venv/bin/activate' >> /etc/bash.bashrc && \
${VENV}/bin/python -c "import torch; import vllm; import mineru; print('MinerU ROCm Docker Image Ready'); print(f'PyTorch {torch.__version__} OK')"
${VENV}/bin/python -c "import torch; import vllm; import mineru; import gradio; import mineru.cli.gradio_app; print('MinerU ROCm Docker Image Ready'); print(f'PyTorch {torch.__version__} OK')"
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["bash"]
+9
View File
@@ -397,6 +397,15 @@ ls /dev/kfd /dev/dri/render*
这是因为 Docker Compose 的 `group_add` 使用的是容器内可解析的组名,而当前 Ubuntu 镜像内不一定存在 `render` 组。Compose 默认以 root 运行容器,并已透传 `/dev/kfd` 和 `/dev/dri`,因此默认只保留 `video` 组,不再添加 `render`。如果你改为非 root 用户运行容器,再按宿主机 `/dev/dri/render*` 的实际 GID 使用数字形式添加,例如 `group_add: ["109"]`。
**Q: `mineru-gradio` 启动时报 `ModuleNotFoundError`**
旧镜像只安装了 `mineru[core]`,可能缺少 WebUI CLI 依赖,例如 `click` 或 `gradio`。当前 Dockerfile 已显式安装 `click gradio`,并在构建期验证 `mineru.cli.gradio_app` 可导入、`mineru-gradio --help` 可执行。修改 Dockerfile 后需要重建镜像:
```bash
docker compose build --no-cache gradio
docker compose up -d --force-recreate
```
**Q: 构建时 `ninja` 被 kill(exit 137)**
内存不足。将 Dockerfile 中 `ninja -j4` 改为 `ninja -j2` 或 `ninja -j1`,或给 Docker 分配更多内存。
+4 -4
View File
@@ -18,7 +18,7 @@ services:
stdin_open: true
tty: true
ipc: host
restart: unless-stopped
restart: on-failure:3
devices:
- /dev/kfd
- /dev/dri
@@ -63,7 +63,7 @@ services:
stdin_open: true
tty: true
ipc: host
restart: unless-stopped
restart: on-failure:3
devices:
- /dev/kfd
- /dev/dri
@@ -91,7 +91,7 @@ services:
stdin_open: true
tty: true
ipc: host
restart: unless-stopped
restart: on-failure:3
devices:
- /dev/kfd
- /dev/dri
@@ -119,7 +119,7 @@ services:
stdin_open: true
tty: true
ipc: host
restart: unless-stopped
restart: on-failure:3
ports:
- "8000:8000"
environment: