Unverified Commit c69b88f5 authored by Yang Yong (雍洋)'s avatar Yang Yong (雍洋) Committed by GitHub
Browse files

Update docker (#456)

parent 87625ec2
FROM pytorch/pytorch:2.8.0-cuda12.8-cudnn9-devel AS base FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 AS base
WORKDIR /app WORKDIR /app
...@@ -7,24 +7,35 @@ ENV LANG=C.UTF-8 ...@@ -7,24 +7,35 @@ ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8 ENV LC_ALL=C.UTF-8
ENV LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH ENV LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
RUN apt-get update && apt-get install -y vim tmux zip unzip wget git git-lfs build-essential libibverbs-dev ca-certificates \ RUN apt-get update && apt-get install -y vim tmux zip unzip bzip2 wget git git-lfs build-essential libibverbs-dev ca-certificates \
curl iproute2 libsm6 libxext6 kmod ccache libnuma-dev libssl-dev flex bison libgtk-3-dev libpango1.0-dev \ curl iproute2 libsm6 libxext6 kmod ccache libnuma-dev libssl-dev flex bison libgtk-3-dev libpango1.0-dev \
libsoup2.4-dev libnice-dev libopus-dev libvpx-dev libx264-dev libsrtp2-dev libglib2.0-dev libdrm-dev\ libsoup2.4-dev libnice-dev libopus-dev libvpx-dev libx264-dev libsrtp2-dev libglib2.0-dev libdrm-dev libjpeg-dev libpng-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/* && git lfs install && apt-get clean && rm -rf /var/lib/apt/lists/* && git lfs install
# install miniconda with Python 3.12
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.9.1-1-Linux-x86_64.sh -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /app/miniconda && \
rm /tmp/miniconda.sh
ENV PATH=/app/miniconda/bin:$PATH
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
RUN conda install conda-forge::ffmpeg=8.0.0 -y && conda clean -all -y
# install torch
RUN pip install --no-cache-dir torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv meson ruff pre-commit fastapi uvicorn requests -U RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv meson ruff pre-commit fastapi uvicorn requests -U
RUN git clone https://github.com/vllm-project/vllm.git && cd vllm \ RUN git clone https://github.com/vllm-project/vllm.git && cd vllm \
&& python use_existing_torch.py && pip install -r requirements/build.txt \ && python use_existing_torch.py && pip install --no-cache-dir -r requirements/build.txt \
&& pip install --no-cache-dir --no-build-isolation -v -e . && pip install --no-cache-dir --no-build-isolation -v -e .
RUN git clone https://github.com/sgl-project/sglang.git && cd sglang/sgl-kernel \ RUN git clone https://github.com/sgl-project/sglang.git && cd sglang/sgl-kernel \
&& make build && make clean && make build && make clean
RUN pip install --no-cache-dir diffusers transformers tokenizers accelerate safetensors opencv-python numpy imageio \ RUN pip install --no-cache-dir diffusers transformers tokenizers accelerate safetensors opencv-python numpy imageio \
imageio-ffmpeg einops loguru qtorch ftfy av decord imageio-ffmpeg einops loguru qtorch ftfy av decord matplotlib debugpy
RUN conda install conda-forge::ffmpeg=8.0.0 -y && ln -s /opt/conda/bin/ffmpeg /usr/bin/ffmpeg && conda clean -all -y
RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive
...@@ -32,13 +43,31 @@ RUN cd flash-attention && python setup.py install && rm -rf build ...@@ -32,13 +43,31 @@ RUN cd flash-attention && python setup.py install && rm -rf build
RUN cd flash-attention/hopper && python setup.py install && rm -rf build RUN cd flash-attention/hopper && python setup.py install && rm -rf build
RUN git clone https://github.com/ModelTC/SageAttention.git RUN git clone https://github.com/ModelTC/SageAttention-1104.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 -v -e . RUN cd SageAttention-1104 && TORCH_CUDA_ARCH_LIST="8.0,8.6,8.9,9.0,12.0" EXT_PARALLEL=4 NVCC_APPEND_FLAGS="--threads 8" MAX_JOBS=32 python setup.py install && rm -rf build
RUN git clone https://github.com/KONAKONA666/q8_kernels.git RUN cd SageAttention-1104/sageattention3_blackwell && python setup.py install && rm -rf build
RUN cd q8_kernels && git submodule init && git submodule update && python setup.py install && rm -rf build RUN git clone https://github.com/SandAI-org/MagiAttention.git --recursive
RUN cd MagiAttention && TORCH_CUDA_ARCH_LIST="9.0" pip install --no-cache-dir --no-build-isolation -v -e .
RUN git clone https://github.com/ModelTC/FlashVSR.git --depth 1
RUN cd FlashVSR && pip install --no-cache-dir -v -e .
COPY lightx2v_kernel /app/lightx2v_kernel
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
# cloud deploy # cloud deploy
RUN pip install --no-cache-dir aio-pika asyncpg>=0.27.0 aioboto3>=12.0.0 PyJWT alibabacloud_dypnsapi20170525==1.2.2 redis==6.4.0 tos RUN pip install --no-cache-dir aio-pika asyncpg>=0.27.0 aioboto3>=12.0.0 PyJWT alibabacloud_dypnsapi20170525==1.2.2 redis==6.4.0 tos
...@@ -47,7 +76,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --de ...@@ -47,7 +76,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --de
ENV PATH=/root/.cargo/bin:$PATH ENV PATH=/root/.cargo/bin:$PATH
RUN cd /opt \ RUN cd /opt \
&& wget https://mirrors.tuna.tsinghua.edu.cn/gnu//libiconv/libiconv-1.15.tar.gz \ && wget https://mirrors.tuna.tsinghua.edu.cn/gnu/libiconv/libiconv-1.15.tar.gz \
&& tar zxvf libiconv-1.15.tar.gz \ && tar zxvf libiconv-1.15.tar.gz \
&& cd libiconv-1.15 \ && cd libiconv-1.15 \
&& ./configure \ && ./configure \
...@@ -56,7 +85,7 @@ RUN cd /opt \ ...@@ -56,7 +85,7 @@ RUN cd /opt \
&& rm -rf /opt/libiconv-1.15 && rm -rf /opt/libiconv-1.15
RUN cd /opt \ RUN cd /opt \
&& git clone https://github.com/GStreamer/gstreamer.git -b 1.24.12 --depth 1 \ && git clone https://github.com/GStreamer/gstreamer.git -b 1.27.2 --depth 1 \
&& cd gstreamer \ && cd gstreamer \
&& meson setup builddir \ && meson setup builddir \
&& meson compile -C builddir \ && meson compile -C builddir \
...@@ -65,7 +94,7 @@ RUN cd /opt \ ...@@ -65,7 +94,7 @@ RUN cd /opt \
&& rm -rf /opt/gstreamer && rm -rf /opt/gstreamer
RUN cd /opt \ RUN cd /opt \
&& git clone https://github.com/GStreamer/gst-plugins-rs.git -b gstreamer-1.24.12 --depth 1 \ && git clone https://github.com/GStreamer/gst-plugins-rs.git -b gstreamer-1.27.2 --depth 1 \
&& cd gst-plugins-rs \ && cd gst-plugins-rs \
&& cargo build --package gst-plugin-webrtchttp --release \ && cargo build --package gst-plugin-webrtchttp --release \
&& install -m 644 target/release/libgstwebrtchttp.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/ \ && install -m 644 target/release/libgstwebrtchttp.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/ \
...@@ -73,4 +102,13 @@ RUN cd /opt \ ...@@ -73,4 +102,13 @@ RUN cd /opt \
RUN ldconfig RUN ldconfig
# q8f for base docker
RUN git clone https://github.com/KONAKONA666/q8_kernels.git --depth 1
RUN cd q8_kernels && git submodule init && git submodule update && python setup.py install && rm -rf build
# q8f for 5090 docker
# RUN git clone https://github.com/ModelTC/LTX-Video-Q8-Kernels.git --depth 1
# RUN cd LTX-Video-Q8-Kernels && git submodule init && git submodule update && python setup.py install && rm -rf build
WORKDIR /workspace WORKDIR /workspace
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 AS base
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
RUN apt-get update && apt-get install -y vim tmux zip unzip bzip2 wget git git-lfs build-essential libibverbs-dev ca-certificates \
curl iproute2 libsm6 libxext6 kmod ccache libnuma-dev libssl-dev flex bison libgtk-3-dev libpango1.0-dev \
libsoup2.4-dev libnice-dev libopus-dev libvpx-dev libx264-dev libsrtp2-dev libglib2.0-dev libdrm-dev libjpeg-dev libpng-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/* && git lfs install
# install miniconda with Python 3.12
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.9.1-1-Linux-x86_64.sh -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /app/miniconda && \
rm /tmp/miniconda.sh
ENV PATH=/app/miniconda/bin:$PATH
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
RUN conda install conda-forge::ffmpeg=8.0.0 -y && conda clean -all -y
# install torch
RUN pip install --no-cache-dir torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv meson ruff pre-commit fastapi uvicorn requests -U
RUN git clone https://github.com/vllm-project/vllm.git && cd vllm \
&& python use_existing_torch.py && pip install --no-cache-dir -r requirements/build.txt \
&& pip install --no-cache-dir --no-build-isolation -v -e .
RUN git clone https://github.com/sgl-project/sglang.git && cd sglang/sgl-kernel \
&& make build && make clean
RUN pip install --no-cache-dir diffusers transformers tokenizers accelerate safetensors opencv-python numpy imageio \
imageio-ffmpeg einops loguru qtorch ftfy av decord matplotlib debugpy
RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive
RUN cd flash-attention && python setup.py install && rm -rf build
RUN cd flash-attention/hopper && python setup.py install && rm -rf build
RUN git clone https://github.com/ModelTC/SageAttention-1104.git --depth 1
RUN cd SageAttention-1104 && TORCH_CUDA_ARCH_LIST="8.0,8.6,8.9,9.0,12.0" EXT_PARALLEL=4 NVCC_APPEND_FLAGS="--threads 8" MAX_JOBS=32 python setup.py install && rm -rf build
RUN cd SageAttention-1104/sageattention3_blackwell && python setup.py install && rm -rf build
RUN git clone https://github.com/SandAI-org/MagiAttention.git --recursive
RUN cd MagiAttention && TORCH_CUDA_ARCH_LIST="9.0" pip install --no-cache-dir --no-build-isolation -v -e .
RUN git clone https://github.com/ModelTC/FlashVSR.git --depth 1
RUN cd FlashVSR && pip install --no-cache-dir -v -e .
COPY lightx2v_kernel /app/lightx2v_kernel
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
# cloud deploy
RUN pip install --no-cache-dir aio-pika asyncpg>=0.27.0 aioboto3>=12.0.0 PyJWT alibabacloud_dypnsapi20170525==1.2.2 redis==6.4.0 tos
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
ENV PATH=/root/.cargo/bin:$PATH
RUN cd /opt \
&& wget https://mirrors.tuna.tsinghua.edu.cn/gnu/libiconv/libiconv-1.15.tar.gz \
&& tar zxvf libiconv-1.15.tar.gz \
&& cd libiconv-1.15 \
&& ./configure \
&& make \
&& make install \
&& rm -rf /opt/libiconv-1.15
RUN cd /opt \
&& git clone https://github.com/GStreamer/gstreamer.git -b 1.27.2 --depth 1 \
&& cd gstreamer \
&& meson setup builddir \
&& meson compile -C builddir \
&& meson install -C builddir \
&& ldconfig \
&& rm -rf /opt/gstreamer
RUN cd /opt \
&& git clone https://github.com/GStreamer/gst-plugins-rs.git -b gstreamer-1.27.2 --depth 1 \
&& cd gst-plugins-rs \
&& cargo build --package gst-plugin-webrtchttp --release \
&& install -m 644 target/release/libgstwebrtchttp.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/ \
&& rm -rf /opt/gst-plugins-rs
RUN ldconfig
# q8f for base docker
# RUN git clone https://github.com/KONAKONA666/q8_kernels.git --depth 1
# RUN cd q8_kernels && git submodule init && git submodule update && python setup.py install && rm -rf build
# q8f for 5090 docker
RUN git clone https://github.com/ModelTC/LTX-Video-Q8-Kernels.git --depth 1
RUN cd LTX-Video-Q8-Kernels && git submodule init && git submodule update && python setup.py install && rm -rf build
WORKDIR /workspace
...@@ -5,7 +5,7 @@ RUN cd /opt/lightx2v/deploy/server/frontend \ ...@@ -5,7 +5,7 @@ RUN cd /opt/lightx2v/deploy/server/frontend \
&& npm install \ && npm install \
&& npm run build && npm run build
FROM lightx2v/lightx2v:25101501-cu128 AS base FROM lightx2v/lightx2v:25110701-cu128 AS base
RUN mkdir /workspace/LightX2V RUN mkdir /workspace/LightX2V
WORKDIR /workspace/LightX2V WORKDIR /workspace/LightX2V
......
...@@ -27,10 +27,10 @@ We strongly recommend using the Docker environment, which is the simplest and fa ...@@ -27,10 +27,10 @@ We strongly recommend using the Docker environment, which is the simplest and fa
#### 1. Pull Image #### 1. Pull Image
Visit LightX2V's [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags), select a tag with the latest date, such as `25101501-cu128`: Visit LightX2V's [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags), select a tag with the latest date, such as `25110701-cu128`:
```bash ```bash
docker pull lightx2v/lightx2v:25101501-cu128 docker pull lightx2v/lightx2v:25110701-cu128
``` ```
We recommend using the `cuda128` environment for faster inference speed. If you need to use the `cuda124` environment, you can use image versions with the `-cu124` suffix: We recommend using the `cuda128` environment for faster inference speed. If you need to use the `cuda124` environment, you can use image versions with the `-cu124` suffix:
...@@ -51,7 +51,7 @@ For mainland China, if the network is unstable when pulling images, you can pull ...@@ -51,7 +51,7 @@ For mainland China, if the network is unstable when pulling images, you can pull
```bash ```bash
# cuda128 # cuda128
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu128 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25110701-cu128
# cuda124 # cuda124
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu124 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu124
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#### 1. 拉取镜像 #### 1. 拉取镜像
访问 LightX2V 的 [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags),选择一个最新日期的 tag,比如 `25101501-cu128` 访问 LightX2V 的 [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags),选择一个最新日期的 tag,比如 `25110701-cu128`
```bash ```bash
docker pull lightx2v/lightx2v:25101501-cu128 docker pull lightx2v/lightx2v:25110701-cu128
``` ```
我们推荐使用`cuda128`环境,以获得更快的推理速度,若需要使用`cuda124`环境,可以使用带`-cu124`后缀的镜像版本: 我们推荐使用`cuda128`环境,以获得更快的推理速度,若需要使用`cuda124`环境,可以使用带`-cu124`后缀的镜像版本:
...@@ -51,7 +51,7 @@ docker run --gpus all -itd --ipc=host --name [容器名] -v [挂载设置] --ent ...@@ -51,7 +51,7 @@ docker run --gpus all -itd --ipc=host --name [容器名] -v [挂载设置] --ent
```bash ```bash
# cuda128 # cuda128
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu128 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25110701-cu128
# cuda124 # cuda124
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu124 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25101501-cu124
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment