fix(deploy): align CUDA vLLM runtime and tag GPU-specific parser images

develop-refact
panyy 2026-11-06 14:53:04 +08:00
parent fd6da48629
commit 9924c6f53f
5 changed files with 15 additions and 8 deletions

3
.gitattributes vendored
View File

@ -2,4 +2,5 @@
*.mjs linguist-vendored
*.html linguist-documentation
*.css linguist-vendored
*.scss linguist-vendored
*.scss linguist-vendored
*.sh text eol=lf

View File

@ -10,5 +10,5 @@ COPY scripts/run_parser.py ./scripts/run_parser.py
RUN python3 -c "import importlib.metadata as m; from pathlib import Path; Path('/tmp/vendor-constraints.txt').write_text(chr(10).join(n+'=='+m.version(n) for n in ('torch','torchvision','vllm')))" \
&& python3 -m pip install --no-cache-dir -c /tmp/vendor-constraints.txt '.[vlm,pipeline,api]'
COPY docker/entrypoint.mineru-api.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]
ENTRYPOINT ["bash", "/entrypoint.sh"]
CMD ["python3", "scripts/run_parser.py", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -10,5 +10,5 @@ COPY scripts/run_parser.py ./scripts/run_parser.py
RUN python3 -c "import importlib.metadata as m; from pathlib import Path; Path('/tmp/vendor-constraints.txt').write_text(chr(10).join(n+'=='+m.version(n) for n in ('torch','torchvision','vllm')))" \
&& python3 -m pip install --no-cache-dir -c /tmp/vendor-constraints.txt '.[vlm,pipeline,api]'
COPY docker/entrypoint.mineru-api.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]
ENTRYPOINT ["bash", "/entrypoint.sh"]
CMD ["python3", "scripts/run_parser.py", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -1,4 +1,4 @@
FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-runtime
FROM vllm/vllm-openai:v0.11.2
ENV MINERU_MODEL_SOURCE=local MINERU_MODEL_DIR=/models PYTHONPATH=/app
RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
@ -7,8 +7,8 @@ COPY pyproject.toml README.mineru-upstream.md LICENSE.md ./
COPY mineru ./mineru
COPY scripts/run_parser.py ./scripts/run_parser.py
# Pin vendor binaries before resolving Python dependencies. Conflicts fail the build rather than replacing vendor Torch.
RUN python3 -c "import importlib.metadata as m; from pathlib import Path; Path('/tmp/vendor-constraints.txt').write_text(chr(10).join(n+'=='+m.version(n) for n in ('torch','torchvision')))" \
RUN python3 -c "import importlib.metadata as m; from pathlib import Path; Path('/tmp/vendor-constraints.txt').write_text(chr(10).join(n+'=='+m.version(n) for n in ('torch','torchvision','vllm')))" \
&& python3 -m pip install --no-cache-dir -c /tmp/vendor-constraints.txt '.[vlm,pipeline,api]'
COPY docker/entrypoint.mineru-api.sh /entrypoint.sh
ENTRYPOINT ["sh", "/entrypoint.sh"]
ENTRYPOINT ["bash", "/entrypoint.sh"]
CMD ["python3", "scripts/run_parser.py", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -1,9 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
case "${API_FLAVOR:-corex}" in
API_FLAVOR=${API_FLAVOR:-corex}
VERSION=${VERSION:-2.7.4}
[[ "$VERSION" =~ ^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$ ]] || exit 2
case "$API_FLAVOR" in
corex) FILE=docker/china/Dockerfile.corex ;;
cuda) FILE=docker/global/Dockerfile.cuda ;;
*) echo "API_FLAVOR must be corex or cuda" >&2; exit 2 ;;
esac
exec docker build -f "$ROOT_DIR/$FILE" -t "unis-mineru:${VERSION:-2.7.4}" "$ROOT_DIR"
exec docker build -f "$ROOT_DIR/$FILE" \
--label io.unis.component=parser --label io.unis.layout=refact --label "io.unis.gpu=$API_FLAVOR" \
--label "org.opencontainers.image.revision=$(git -C "$ROOT_DIR" rev-parse HEAD)" \
-t "unis-mineru:$VERSION-$API_FLAVOR" -t "unis-mineru:$VERSION" "$ROOT_DIR"