From 9924c6f53fc0bc6a50df9b1fea35b8ebd70ad92c Mon Sep 17 00:00:00 2001 From: panyy Date: Fri, 6 Nov 2026 14:53:04 +0800 Subject: [PATCH] fix(deploy): align CUDA vLLM runtime and tag GPU-specific parser images --- .gitattributes | 3 ++- docker/china/Dockerfile | 2 +- docker/china/Dockerfile.corex | 2 +- docker/global/Dockerfile.cuda | 6 +++--- scripts/build-images.sh | 10 ++++++++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.gitattributes b/.gitattributes index 9ed5841..5d2d462 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,4 +2,5 @@ *.mjs linguist-vendored *.html linguist-documentation *.css linguist-vendored -*.scss linguist-vendored \ No newline at end of file +*.scss linguist-vendored +*.sh text eol=lf diff --git a/docker/china/Dockerfile b/docker/china/Dockerfile index 2ac5afa..12c1aac 100644 --- a/docker/china/Dockerfile +++ b/docker/china/Dockerfile @@ -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"] diff --git a/docker/china/Dockerfile.corex b/docker/china/Dockerfile.corex index 2ac5afa..12c1aac 100644 --- a/docker/china/Dockerfile.corex +++ b/docker/china/Dockerfile.corex @@ -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"] diff --git a/docker/global/Dockerfile.cuda b/docker/global/Dockerfile.cuda index 311cb53..9ea5aaa 100644 --- a/docker/global/Dockerfile.cuda +++ b/docker/global/Dockerfile.cuda @@ -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"] diff --git a/scripts/build-images.sh b/scripts/build-images.sh index de84833..7b2bde9 100644 --- a/scripts/build-images.sh +++ b/scripts/build-images.sh @@ -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"