Skip to content

refactor(dockerfile): reorganize Dockerfile management#1200

Merged
shihaobai merged 8 commits intomainfrom
docker-update
Feb 2, 2026
Merged

refactor(dockerfile): reorganize Dockerfile management#1200
shihaobai merged 8 commits intomainfrom
docker-update

Conversation

@shihaobai
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shihaobai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly simplifies the Docker build infrastructure by consolidating numerous specialized Dockerfiles into a single, highly configurable Dockerfile. This change improves maintainability and reduces redundancy by leveraging build arguments to enable or disable features like DeepEP, NIXL, and caching, while also updating the base CUDA version. The introduction of dedicated build scripts further streamlines the process of generating various image configurations.

Highlights

  • Dockerfile Consolidation: Multiple specialized Dockerfiles (e.g., for DeepEP, NIXL, and CUDA versions) have been removed and their functionalities merged into a single, unified docker/Dockerfile.
  • Parameterized Builds: The main docker/Dockerfile now uses build arguments (VLLM_VERSION, ENABLE_DEEPEP, ENABLE_NIXL, ENABLE_CACHE) to conditionally install specific components, allowing for flexible image configurations from a single source.
  • CUDA Version Update: The default CUDA version used in the Dockerfile has been updated from 12.6.1 to 12.8.0.
  • New Build Scripts: A set of new shell scripts (build_deepep.sh, build_default.sh, build_nixl.sh, build_nixl_deepep.sh, build_nixl_deepep_cache.sh) has been introduced to simplify the process of building different Docker image variants using the new parameterized Dockerfile.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/docker-publish.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great step towards simplifying the build process by consolidating numerous Dockerfiles into a single, parameterized one. This significantly improves maintainability. My review includes a few suggestions to further enhance the new Dockerfile. I've pointed out a security concern with directory permissions, recommended refactoring a very large and complex RUN command to improve readability and build efficiency, and identified an inconsistent CUDA version in one of the new build scripts. Addressing these points will make the new build process more robust and maintainable.

Comment on lines 55 to 130
RUN set -e; \
if [ "${ENABLE_CACHE}" = "1" ]; then \
/opt/conda/bin/conda install -y boost && /opt/conda/bin/conda clean -ya; \
LIGHTMEM_REF=5900baf92d85ef4dbda6124093506b0af906011a; \
pip install --no-deps -v "git+https://github.com/ModelTC/LightMem.git@${LIGHTMEM_REF}#egg=light_mem"; \
fi; \
if [ "${ENABLE_NIXL}" = "1" ] || [ "${ENABLE_DEEPEP}" = "1" ]; then \
apt-get update && apt-get install -y wget devscripts debhelper dh-make build-essential dkms && \
apt-get install -y ibverbs-providers infiniband-diags perftest rdma-core libibverbs-dev librdmacm-dev && \
rm -rf /var/lib/apt/lists/*; \
mkdir -p /tmp/gdrcopy && cd /tmp \
&& git clone https://github.com/NVIDIA/gdrcopy.git -b v2.4.4 \
&& cd gdrcopy/packages \
&& CUDA=/usr/local/cuda ./build-deb-packages.sh \
&& dpkg -i gdrdrv-dkms_*.deb libgdrapi_*.deb gdrcopy-tests_*.deb gdrcopy_*.deb \
&& cd / && rm -rf /tmp/gdrcopy; \
fi; \
if [ "${ENABLE_DEEPEP}" = "1" ]; then \
ln -sf /usr/lib/x86_64-linux-gnu/libmlx5.so.1 /usr/lib/x86_64-linux-gnu/libmlx5.so; \
NVSHMEM_VERSION=3.3.9; \
CUDA_ARCHS=90; \
wget https://developer.download.nvidia.com/compute/redist/nvshmem/${NVSHMEM_VERSION}/source/nvshmem_src_cuda12-all-all-${NVSHMEM_VERSION}.tar.gz \
&& tar -xf nvshmem_src_cuda12-all-all-${NVSHMEM_VERSION}.tar.gz && mv nvshmem_src nvshmem \
&& cd nvshmem \
&& rm -f /root/nvshmem_src_cuda12-all-all-${NVSHMEM_VERSION}.tar.gz \
&& NVSHMEM_SHMEM_SUPPORT=0 \
NVSHMEM_UCX_SUPPORT=0 \
NVSHMEM_USE_NCCL=0 \
NVSHMEM_MPI_SUPPORT=0 \
NVSHMEM_IBGDA_SUPPORT=1 \
NVSHMEM_PMIX_SUPPORT=0 \
NVSHMEM_TIMEOUT_DEVICE_POLLING=0 \
NVSHMEM_USE_GDRCOPY=1 \
cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX=/root/nvshmem/install -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCHS} \
&& cmake --build build --target install -j64; \
DEEPEP_COMMIT=b6ce310bb0b75079682d09bc2ebc063a074fbd58; \
git clone https://github.com/deepseek-ai/DeepEP.git && cd DeepEP && git checkout ${DEEPEP_COMMIT} && cd ..; \
cd /root/DeepEP && NVSHMEM_DIR=/root/nvshmem/install python setup.py install; \
fi; \
if [ "${ENABLE_NIXL}" = "1" ]; then \
apt-get update && apt-get install -y cmake automake autotools-dev libtool libz-dev && \
DEBIAN_FRONTEND=noninteractive apt-get -y install --reinstall libibverbs-dev rdma-core ibverbs-utils libibumad-dev; \
rm -rf /usr/lib/ucx && rm -rf /opt/hpcx/ucx && \
cd /usr/local/src && \
git clone https://github.com/openucx/ucx.git && \
cd ucx && \
git checkout v1.19.x && \
./autogen.sh && ./configure \
--enable-shared \
--disable-static \
--disable-doxygen-doc \
--enable-optimizations \
--enable-cma \
--enable-devel-headers \
--with-cuda=/usr/local/cuda \
--with-verbs=yes \
--with-dm \
--with-gdrcopy=/usr/local \
--with-efa \
--enable-mt && \
make -j && \
make -j install-strip && \
ldconfig; \
apt-get update && apt-get install -y pkg-config tmux net-tools && \
cd /usr/local/src; \
pip install --upgrade meson pybind11 patchelf; \
git clone https://github.com/ai-dynamo/nixl.git -b main && \
cd nixl && \
rm -rf build && \
mkdir build && \
meson setup build/ --prefix=/usr/local/nixl --buildtype=release && \
cd build && \
ninja && \
ninja install && \
cd .. && pip install . --no-deps; \
fi;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This large RUN block has become very complex, which impacts maintainability, readability, and build efficiency. I recommend refactoring it with the following points in mind:

  • Refactor to a script: The logic is complex enough to be moved to a separate shell script (e.g., install_dependencies.sh). You could COPY and RUN this script, which would make the Dockerfile much cleaner and the logic easier to debug.
  • Consolidate apt-get commands: There are multiple apt-get update calls across the Dockerfile (e.g., lines 16, 50, 62, 95). All package installations should be done in a single layer after one apt-get update to improve build speed and reduce image size.
  • Use ARG for versions: Several commit hashes and versions are hardcoded (e.g., LIGHTMEM_REF, NVSHMEM_VERSION, DEEPEP_COMMIT). Moving these to ARGs at the top of the file makes them easier to manage.

cd "${ROOT_DIR}"

IMAGE_PREFIX="${IMAGE_PREFIX:-lightllm}"
CUDA_VERSION="${CUDA_VERSION:-12.6.1}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The CUDA_VERSION is hardcoded to 12.6.1 here, while the other new build scripts default to 12.8.0. This inconsistency can lead to confusion and unexpected build behavior. If this specific version is required for the nixl.deepep build, please add a comment explaining why. Otherwise, it should be aligned with the other scripts for consistency.

Suggested change
CUDA_VERSION="${CUDA_VERSION:-12.6.1}"
CUDA_VERSION="${CUDA_VERSION:-12.8.0}"

g++ \
make \
git && \
RUN chmod 777 -R /tmp && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

chmod 777 -R /tmp grants universal read, write, and execute permissions, which is a security risk. A more secure practice is to use chmod 1777 /tmp, which sets the sticky bit. This allows any user to create files in /tmp, but only the file's owner can delete or rename them.

RUN chmod 1777 -R /tmp && \

@shihaobai shihaobai changed the title simplify dockerfile refactor(dockerfile): reorganize Dockerfile management Feb 2, 2026
@shihaobai shihaobai merged commit d3397d7 into main Feb 2, 2026
1 check passed
@shihaobai shihaobai deleted the docker-update branch February 2, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant