Skip to content

update docker#1225

Open
helloyongyang wants to merge 1 commit into
mainfrom
gf
Open

update docker#1225
helloyongyang wants to merge 1 commit into
mainfrom
gf

Conversation

@helloyongyang

Copy link
Copy Markdown
Contributor

No description provided.

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

Copy link
Copy Markdown
Contributor

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 introduces a new Conda-based Dockerfile (Dockerfile_cu130_conda) and updates existing Dockerfiles to adjust dependency installations. Key feedback focuses on optimizing the Docker image size by using --no-cache-dir for large packages, avoiding editable installs (-e) for custom attention kernels, and cleaning up cloned repositories after installation. Additionally, there are recommendations to remove the standalone bson package to prevent namespace clashes with pymongo, fix the scoping of the MAX_JOBS environment variable during the uv build step, and correct an inaccurate Python version comment in the ROS2 Jazzy Dockerfile.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv meson ruff pre-commit fastapi uvicorn requests -U

RUN pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 --index-url https://download.pytorch.org/whl/cu130

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

PyTorch, torchvision, and torchaudio are extremely large packages. Installing them without --no-cache-dir causes pip to cache the downloaded wheels in /root/.cache/pip, which unnecessarily doubles the required disk space and significantly increases the final Docker image size. The same applies to vllm and sglang-kernel on lines 31 and 33.

RUN pip install --no-cache-dir torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 --index-url https://download.pytorch.org/whl/cu130


RUN pip install --no-cache-dir jsonschema pymongo mooncake-transfer-engine tos zmq graphviz pybind11

RUN pip install --no-cache-dir bson aio-pika PyJWT asyncpg>=0.27.0 aioboto3>=12.0.0 alibabacloud_dypnsapi20170525==1.2.2 redis==6.4.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Installing the standalone bson package from PyPI alongside pymongo will cause a name clash and overwrite pymongo's internal bson module, leading to runtime import errors (e.g., AttributeError when using pymongo). Since pymongo already includes its own bson implementation, you should remove bson from this pip install command.

RUN pip install --no-cache-dir aio-pika PyJWT asyncpg>=0.27.0 aioboto3>=12.0.0 alibabacloud_dypnsapi20170525==1.2.2 redis==6.4.0

RUN pip install --no-cache-dir https://github.com/windreamer/flash-attention3-wheels/releases/download/2026.05.11-5e0e3b1/flash_attn_3-3.0.0%2B20260511.cu130torch2110cxx11abitrue.ab6632-cp39-abi3-linux_x86_64.whl

# FA4 build from source: https://github.com/Dao-AILab/flash-attention
RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive && cd flash-attention && pip install -e "flash_attn/cute[dev,cu13]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Installing flash-attention in editable mode (-e) prevents you from deleting the cloned repository, which leaves a large amount of unnecessary source files in the Docker image. Since this is a production/runtime image, you should install it normally and clean up the cloned repository to reduce the image size.

RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive && \n    cd flash-attention && \n    pip install --no-cache-dir "flash_attn/cute[dev,cu13]" && \n    cd .. && \n    rm -rf flash-attention

Comment on lines +60 to +67
RUN git clone https://github.com/ModelTC/SageAttention.git --depth 1

RUN cd SageAttention && \
CUDA_ARCHITECTURES="8.0,8.6,8.9,9.0,12.0" \
EXT_PARALLEL=4 \
NVCC_APPEND_FLAGS="--threads 8" \
MAX_JOBS=32 \
pip install --no-cache-dir --no-build-isolation -v -e .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Installing SageAttention in editable mode (-e) prevents cleaning up the cloned repository. Installing it normally and removing the cloned directory will significantly reduce the Docker image size.

RUN git clone https://github.com/ModelTC/SageAttention.git --depth 1 && \n    cd SageAttention && \n    CUDA_ARCHITECTURES="8.0,8.6,8.9,9.0,12.0" \n    EXT_PARALLEL=4 \n    NVCC_APPEND_FLAGS="--threads 8" \n    MAX_JOBS=32 \n    pip install --no-cache-dir --no-build-isolation -v . && \n    cd .. && \n    rm -rf SageAttention

Comment on lines +69 to +71
RUN git clone https://github.com/ModelTC/SageAttention-1104.git --depth 1

RUN cd SageAttention-1104/sageattention3_blackwell && python setup.py install && rm -rf build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The cloned SageAttention-1104 repository is not cleaned up after installation, which unnecessarily increases the Docker image size. You should remove the directory at the end of the RUN instruction.

RUN git clone https://github.com/ModelTC/SageAttention-1104.git --depth 1 && \n    cd SageAttention-1104/sageattention3_blackwell && \n    python setup.py install && \n    cd /app && \n    rm -rf SageAttention-1104

Comment on lines +79 to +87
RUN git clone https://github.com/NVIDIA/cutlass.git --depth 1 && cd /app/lightx2v_kernel && MAX_JOBS=32 && CMAKE_BUILD_PARALLEL_LEVEL=4 \
uv build --wheel \
-Cbuild-dir=build . \
-Ccmake.define.CUTLASS_PATH=/app/cutlass \
--verbose \
--color=always \
--no-build-isolation \
&& pip install dist/*whl --force-reinstall --no-deps \
&& rm -rf /app/lightx2v_kernel && rm -rf /app/cutlass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The environment variable MAX_JOBS=32 is separated from the uv build command by &&, which means it is treated as a separate shell command and will not be exported to the environment of uv build. To ensure MAX_JOBS is correctly passed to the build process, it should directly prefix the command or be exported. Also, adding --no-cache-dir to the pip install command is recommended to avoid caching the built wheel.

RUN git clone https://github.com/NVIDIA/cutlass.git --depth 1 && cd /app/lightx2v_kernel && \n    MAX_JOBS=32 CMAKE_BUILD_PARALLEL_LEVEL=4 uv build --wheel \n        -Cbuild-dir=build . \n        -Ccmake.define.CUTLASS_PATH=/app/cutlass \n        --verbose \n        --color=always \n        --no-build-isolation \n    && pip install --no-cache-dir dist/*whl --force-reinstall --no-deps \n    && rm -rf /app/lightx2v_kernel /app/cutlass

Comment on lines +89 to +96
RUN git clone --depth 1 https://github.com/linux-rdma/rdma-core.git && \
cd rdma-core/ && \
mkdir build-ibv57 && \
cd build-ibv57 && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DNO_MAN_PAGES=1 && \
make -j"$(nproc)" && \
make install && \
ldconfig

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The cloned rdma-core repository and its build directory are not cleaned up after installation, which unnecessarily increases the Docker image size. You should remove the rdma-core directory at the end of the RUN instruction.

RUN git clone --depth 1 https://github.com/linux-rdma/rdma-core.git && \n    cd rdma-core/ && \n    mkdir build-ibv57 && \n    cd build-ibv57 && \n    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DNO_MAN_PAGES=1 && \n    make -j"$(nproc)" && \n    make install && \n    ldconfig && \n    cd /app && \n    rm -rf rdma-core

Comment on lines +99 to +100
RUN git clone https://github.com/ModelTC/q8_kernels.git --depth 1
RUN cd q8_kernels && git submodule init && git submodule update && python setup.py install && rm -rf build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The cloned q8_kernels repository is not cleaned up after installation, which unnecessarily increases the Docker image size. You should remove the directory at the end of the RUN instruction.

RUN git clone https://github.com/ModelTC/q8_kernels.git --depth 1 && \n    cd q8_kernels && \n    git submodule init && \n    git submodule update && \n    python setup.py install && \n    cd .. && \n    rm -rf q8_kernels

Comment on lines +102 to +103
RUN git clone https://github.com/ModelTC/SpargeAttn.git --depth 1
RUN cd SpargeAttn && TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9;9.0" pip install --no-cache-dir --no-build-isolation -v -e .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Installing SpargeAttn in editable mode (-e) prevents cleaning up the cloned repository. Installing it normally and removing the cloned directory will significantly reduce the Docker image size.

RUN git clone https://github.com/ModelTC/SpargeAttn.git --depth 1 && \n    cd SpargeAttn && \n    TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9;9.0" pip install --no-cache-dir --no-build-isolation -v . && \n    cd .. && \n    rm -rf SpargeAttn

FROM lightx2v/lightx2v:26062001-cu130 AS base
# ubuntu 24.04 python 3.12 torch 2.11 cuda 13.0
FROM lightx2v/lightx2v:26070401-cu130 AS base
# ubuntu 24.04 python 3.11 torch 2.11 cuda 13.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The base image lightx2v/lightx2v:26070401-cu130 is built from Dockerfile_cu130, which uses Python 3.12 (as seen in its base image pytorch/pytorch:2.11.0-cuda13.0-cudnn9-devel and its flash_attn wheel). Changing this comment to python 3.11 is incorrect and misleading.

# ubuntu 24.04 python 3.12 torch 2.11 cuda 13.0

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