|
1 |
| -ARG CUDA_VERSION=12.8.1 |
2 |
| -FROM --platform=linux/amd64 nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04 |
3 |
| - |
4 |
| -# Needs to be repeated below the FROM, or else it's not picked up |
5 |
| -ARG PYTHON_VERSION=3.12 |
6 |
| -ARG CUDA_VERSION=12.8.1 |
7 |
| - |
8 |
| -# Set environment variable to prevent interactive prompts |
9 |
| -ENV DEBIAN_FRONTEND=noninteractive |
10 |
| - |
11 |
| -# From original VLLM dockerfile https://github.com/vllm-project/vllm/blob/main/docker/Dockerfile |
12 |
| -# Install Python and other dependencies |
13 |
| -RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \ |
14 |
| - && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \ |
15 |
| - && apt-get update -y \ |
16 |
| - && apt-get install -y ccache software-properties-common git curl sudo python3-apt \ |
17 |
| - && for i in 1 2 3; do \ |
18 |
| - add-apt-repository -y ppa:deadsnakes/ppa && break || \ |
19 |
| - { echo "Attempt $i failed, retrying in 5s..."; sleep 5; }; \ |
20 |
| - done \ |
21 |
| - && apt-get update -y \ |
22 |
| - && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv |
23 |
| - |
24 |
| -# olmOCR Specific Installs - Install fonts BEFORE changing Python version |
25 |
| -RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \ |
| 1 | +FROM vllm/vllm-openai:v0.11.0 |
| 2 | + |
| 3 | +ENV PYTHON_VERSION=3.12 |
| 4 | +ENV CUSTOM_PY="/usr/bin/python${PYTHON_VERSION}" |
| 5 | + |
| 6 | +# Workaround for installing fonts, which are needed for good rendering of documents |
| 7 | +RUN DIST_PY=$(ls /usr/bin/python3.[0-9]* | sort -V | head -n1) && \ |
| 8 | + # If a python alternative scheme already exists, remember its value so we \ |
| 9 | + # can restore it later; otherwise, we will restore to CUSTOM_PY when we \ |
| 10 | + # are done. \ |
| 11 | + if update-alternatives --query python3 >/dev/null 2>&1; then \ |
| 12 | + ORIGINAL_PY=$(update-alternatives --query python3 | awk -F": " '/Value:/ {print $2}'); \ |
| 13 | + else \ |
| 14 | + ORIGINAL_PY=$CUSTOM_PY; \ |
| 15 | + fi && \ |
| 16 | + # ---- APT operations that require the distro python3 ------------------- \ |
| 17 | + echo "Temporarily switching python3 alternative to ${DIST_PY} so that APT scripts use the distro‑built Python runtime." && \ |
| 18 | + update-alternatives --install /usr/bin/python3 python3 ${DIST_PY} 1 && \ |
| 19 | + update-alternatives --set python3 ${DIST_PY} && \ |
| 20 | + update-alternatives --install /usr/bin/python python ${DIST_PY} 1 && \ |
| 21 | + update-alternatives --set python ${DIST_PY} && \ |
26 | 22 | apt-get update -y && \
|
27 |
| - apt-get install -y --no-install-recommends poppler-utils fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools ttf-mscorefonts-installer |
28 |
| - |
29 |
| -# Now update Python alternatives |
30 |
| -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \ |
31 |
| - && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \ |
32 |
| - && update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 1 \ |
33 |
| - && update-alternatives --set python /usr/bin/python${PYTHON_VERSION} \ |
34 |
| - && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \ |
35 |
| - && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \ |
36 |
| - && python3 --version && python3 -m pip --version |
37 |
| - |
38 |
| -# Install uv for faster pip installs |
39 |
| -RUN --mount=type=cache,target=/root/.cache/uv python3 -m pip install uv |
40 |
| - |
41 |
| -# Install some helper utilities for things like the benchmark |
42 |
| -RUN apt-get update -y && apt-get install -y --no-install-recommends \ |
43 |
| - git \ |
44 |
| - git-lfs \ |
45 |
| - curl \ |
46 |
| - wget \ |
47 |
| - unzip |
48 |
| - |
49 |
| -ENV PYTHONUNBUFFERED=1 |
| 23 | + apt-get remove -y python3-blinker || true && \ |
| 24 | + # Pre‑seed the Microsoft Core Fonts EULA so the build is non‑interactive \ |
| 25 | + echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \ |
| 26 | + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| 27 | + python3-apt \ |
| 28 | + update-notifier-common \ |
| 29 | + poppler-utils \ |
| 30 | + fonts-crosextra-caladea \ |
| 31 | + fonts-crosextra-carlito \ |
| 32 | + gsfonts \ |
| 33 | + lcdf-typetools \ |
| 34 | + ttf-mscorefonts-installer \ |
| 35 | + git git-lfs curl wget unzip && \ |
| 36 | + # ---- Restore the original / custom Python alternative ----------------- \ |
| 37 | + echo "Restoring python3 alternative to ${ORIGINAL_PY}" && \ |
| 38 | + update-alternatives --install /usr/bin/python3 python3 ${ORIGINAL_PY} 1 && \ |
| 39 | + update-alternatives --set python3 ${ORIGINAL_PY} && \ |
| 40 | + update-alternatives --install /usr/bin/python python ${ORIGINAL_PY} 1 || true && \ |
| 41 | + update-alternatives --set python ${ORIGINAL_PY} || true && \ |
| 42 | + # Ensure pip is available for the restored Python \ |
| 43 | + curl -sS https://bootstrap.pypa.io/get-pip.py | ${ORIGINAL_PY} |
50 | 44 |
|
51 | 45 | # keep the build context clean
|
52 | 46 | WORKDIR /build
|
53 | 47 | COPY . /build
|
54 | 48 |
|
55 |
| - |
56 | 49 | # Needed to resolve setuptools dependencies
|
57 | 50 | ENV UV_INDEX_STRATEGY="unsafe-best-match"
|
58 |
| -RUN uv pip install --system --no-cache ".[gpu]" --extra-index-url https://download.pytorch.org/whl/cu128 |
59 |
| -RUN uv pip install --system https://download.pytorch.org/whl/cu128/flashinfer/flashinfer_python-0.2.6.post1%2Bcu128torch2.7-cp39-abi3-linux_x86_64.whl |
60 | 51 | RUN uv pip install --system --no-cache ".[bench]"
|
61 | 52 |
|
62 | 53 | RUN playwright install-deps
|
|
0 commit comments