Dockerfile 4.8 KB
Newer Older
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
1
FROM nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04 AS base
helloyongyang's avatar
helloyongyang committed
2

helloyongyang's avatar
helloyongyang committed
3
WORKDIR /app
4

helloyongyang's avatar
helloyongyang committed
5
6
7
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
LiangLiu's avatar
LiangLiu committed
8
ENV LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
helloyongyang's avatar
helloyongyang committed
9

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
10
RUN apt-get update && apt-get install -y vim tmux zip unzip bzip2 wget git git-lfs build-essential libibverbs-dev ca-certificates \
LiangLiu's avatar
LiangLiu committed
11
    curl iproute2 libsm6 libxext6 kmod ccache libnuma-dev libssl-dev flex bison libgtk-3-dev libpango1.0-dev \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
12
    libsoup2.4-dev libnice-dev libopus-dev libvpx-dev libx264-dev libsrtp2-dev libglib2.0-dev libdrm-dev libjpeg-dev libpng-dev \
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
13
    && apt-get clean && rm -rf /var/lib/apt/lists/* && git lfs install
helloyongyang's avatar
helloyongyang committed
14

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

LiangLiu's avatar
LiangLiu committed
28
RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv meson ruff pre-commit fastapi uvicorn requests -U
helloyongyang's avatar
helloyongyang committed
29
30

RUN git clone https://github.com/vllm-project/vllm.git && cd vllm \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
31
    && python use_existing_torch.py && pip install --no-cache-dir -r requirements/build.txt \
helloyongyang's avatar
helloyongyang committed
32
    && pip install --no-cache-dir --no-build-isolation -v -e .
helloyongyang's avatar
helloyongyang committed
33

helloyongyang's avatar
helloyongyang committed
34
35
RUN git clone https://github.com/sgl-project/sglang.git && cd sglang/sgl-kernel \
    && make build && make clean
helloyongyang's avatar
helloyongyang committed
36

helloyongyang's avatar
helloyongyang committed
37
RUN pip install --no-cache-dir diffusers transformers tokenizers accelerate safetensors opencv-python numpy imageio \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
38
    imageio-ffmpeg einops loguru qtorch ftfy av decord matplotlib debugpy
LiangLiu's avatar
LiangLiu committed
39

helloyongyang's avatar
helloyongyang committed
40
RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive
helloyongyang's avatar
helloyongyang committed
41

helloyongyang's avatar
helloyongyang committed
42
43
44
45
RUN cd flash-attention && python setup.py install && rm -rf build

RUN cd flash-attention/hopper && python setup.py install && rm -rf build

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
46
RUN git clone https://github.com/ModelTC/SageAttention-1104.git --depth 1
helloyongyang's avatar
helloyongyang committed
47

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
48
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
helloyongyang's avatar
helloyongyang committed
49

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
50
RUN cd SageAttention-1104/sageattention3_blackwell && python setup.py install && rm -rf build
51

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
71

LiangLiu's avatar
LiangLiu committed
72
# cloud deploy
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
73
74
75
76
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
LiangLiu's avatar
LiangLiu committed
77
78

RUN cd /opt \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
79
    && wget https://mirrors.tuna.tsinghua.edu.cn/gnu/libiconv/libiconv-1.15.tar.gz \
LiangLiu's avatar
LiangLiu committed
80
81
82
83
    && tar zxvf libiconv-1.15.tar.gz \
    && cd libiconv-1.15 \
    && ./configure \
    && make \
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
84
85
    && make install \
    && rm -rf /opt/libiconv-1.15
LiangLiu's avatar
LiangLiu committed
86
87

RUN cd /opt \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
88
    && git clone https://github.com/GStreamer/gstreamer.git -b 1.27.2 --depth 1 \
LiangLiu's avatar
LiangLiu committed
89
90
91
92
    && cd gstreamer \
    && meson setup builddir \
    && meson compile -C builddir \
    && meson install -C builddir \
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
93
94
    && ldconfig \
    && rm -rf /opt/gstreamer
LiangLiu's avatar
LiangLiu committed
95
96

RUN cd /opt \
Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
97
    && git clone https://github.com/GStreamer/gst-plugins-rs.git -b gstreamer-1.27.2 --depth 1 \
LiangLiu's avatar
LiangLiu committed
98
99
    && cd gst-plugins-rs \
    && cargo build --package gst-plugin-webrtchttp --release \
Yang Yong(雍洋)'s avatar
Yang Yong(雍洋) committed
100
101
    && install -m 644 target/release/libgstwebrtchttp.so $(pkg-config --variable=pluginsdir gstreamer-1.0)/ \
    && rm -rf /opt/gst-plugins-rs
LiangLiu's avatar
LiangLiu committed
102
103
104

RUN ldconfig

Yang Yong (雍洋)'s avatar
Yang Yong (雍洋) committed
105
106
107
108
109
110
111
112
113

# 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

helloyongyang's avatar
helloyongyang committed
114
WORKDIR /workspace