35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/bash
|
|
# =============================================================================
|
|
# MinerU ROCm 统一入口 — 启动时执行补丁,然后启动指定服务
|
|
# =============================================================================
|
|
set -e
|
|
|
|
VENV=/opt/mineru_venv
|
|
SCRIPTS_DIR=/opt/scripts
|
|
|
|
echo "[entrypoint] running patches..."
|
|
|
|
# vllm 平台补丁(非致命:非 GPU 容器可能失败)
|
|
if [ -f ${SCRIPTS_DIR}/patch_vllm_platform.py ]; then
|
|
set +e
|
|
${VENV}/bin/python ${SCRIPTS_DIR}/patch_vllm_platform.py
|
|
vllm_rc=$?
|
|
set -e
|
|
if [ $vllm_rc -ne 0 ]; then
|
|
echo "[entrypoint] patch_vllm_platform.py exited with $vllm_rc (non-fatal for router/gradio)"
|
|
fi
|
|
fi
|
|
|
|
# MinerU 推理补丁
|
|
if [ -f ${SCRIPTS_DIR}/apply_mineru_patches.py ]; then
|
|
${VENV}/bin/python ${SCRIPTS_DIR}/apply_mineru_patches.py || echo "[entrypoint] apply_mineru_patches.py failed (non-fatal)"
|
|
fi
|
|
|
|
# 确保 vllm 源码目录在 PYTHONPATH 中
|
|
# patch_vllm_platform.py 中的 os.environ 修改不持久化到父进程
|
|
# 这里无条件导出,防止 editable install 被破坏后 vllm 无法导入
|
|
export PYTHONPATH="/opt/vllm:${PYTHONPATH}"
|
|
|
|
echo "[entrypoint] starting: $*"
|
|
exec "$@"
|