@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 7012d8b45e
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 12, 14:45 UTC

[Docker] Optimize Dockerfile: consolidate apt-get and reduce image size by ~200MB (#29060)

Signed-off-by: princepride <wangzhipeng628@gmail.com>

汪志鹏 committed Nov 25, 2025 at 10:54 UTC 7012d8b45e677a4316e38be6fb9547de2993b519
1 file changed +30 -9
docker/Dockerfile
+30 -9
@@ -85,7 +85,20 @@ ARG GET_PIP_URL
85 RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
86 && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
87 && apt-get update -y \
88 - && apt-get install -y ccache software-properties-common git curl sudo python3-pip libibverbs-dev \
88 + && apt-get install -y --no-install-recommends \
89 + ccache \
90 + software-properties-common \
91 + git \
92 + curl \
93 + sudo \
94 + python3-pip \
95 + libibverbs-dev \
96 + # Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
97 + # as it was causing spam when compiling the CUTLASS kernels
98 + gcc-10 \
99 + g++-10 \
100 + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 110 --slave /usr/bin/g++ g++ /usr/bin/g++-10 \
101 + && rm -rf /var/lib/apt/lists/* \
102 && curl -LsSf https://astral.sh/uv/install.sh | sh \
103 && $HOME/.local/bin/uv venv /opt/venv --python ${PYTHON_VERSION} \
104 && rm -f /usr/bin/python3 /usr/bin/python3-config /usr/bin/pip \
@@ -110,10 +123,6 @@ ENV UV_INDEX_STRATEGY="unsafe-best-match"
123 # Use copy mode to avoid hardlink failures with Docker cache mounts
124 ENV UV_LINK_MODE=copy
125
113 -# Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
114 -# as it was causing spam when compiling the CUTLASS kernels
115 -RUN apt-get install -y gcc-10 g++-10
116 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 110 --slave /usr/bin/g++ g++ /usr/bin/g++-10
126 RUN <<EOF
127 gcc --version
128 EOF
@@ -268,7 +277,7 @@ ENV UV_INDEX_STRATEGY="unsafe-best-match"
277 ENV UV_LINK_MODE=copy
278
279 # Install libnuma-dev, required by fastsafetensors (fixes #20384)
271 -RUN apt-get update && apt-get install -y libnuma-dev && rm -rf /var/lib/apt/lists/*
280 +RUN apt-get update && apt-get install -y --no-install-recommends libnuma-dev && rm -rf /var/lib/apt/lists/*
281 COPY requirements/lint.txt requirements/lint.txt
282 COPY requirements/test.txt requirements/test.txt
283 COPY requirements/dev.txt requirements/dev.txt
@@ -305,8 +314,15 @@ RUN PYTHON_VERSION_STR=$(echo ${PYTHON_VERSION} | sed 's/\.//g') && \
314 RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
315 && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
316 && apt-get update -y \
308 - && apt-get install -y software-properties-common curl sudo python3-pip \
309 - && apt-get install -y ffmpeg libsm6 libxext6 libgl1 \
317 + && apt-get install -y --no-install-recommends \
318 + software-properties-common \
319 + curl \
320 + sudo \
321 + python3-pip \
322 + ffmpeg \
323 + libsm6 \
324 + libxext6 \
325 + libgl1 \
326 && if [ ! -z ${DEADSNAKES_MIRROR_URL} ] ; then \
327 if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then \
328 mkdir -p -m 0755 /etc/apt/keyrings ; \
@@ -321,7 +337,12 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
337 done ; \
338 fi \
339 && apt-get update -y \
324 - && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv libibverbs-dev \
340 + && apt-get install -y --no-install-recommends \
341 + python${PYTHON_VERSION} \
342 + python${PYTHON_VERSION}-dev \
343 + python${PYTHON_VERSION}-venv \
344 + libibverbs-dev \
345 + && rm -rf /var/lib/apt/lists/* \
346 && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
347 && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
348 && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \