From 36dbb5b6913f327f0ea994fe9856bd584de37a8b Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 16 Sep 2025 09:16:54 +0800 Subject: [PATCH] . --- Dockerfile | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef3eadf2f..9ab7a61b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,7 +84,7 @@ RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \ # โ”€โ”€ ๐Ÿ”„ ไธ‹่ฝฝ sgl-kernel๏ผˆไธŽ sglang ๅŒๆญฅ๏ผ‰โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ -RUN pip download --only-binary=:all: --no-deps sgl-kernel==0.3.7 -d /tmp/sgl_kernel_wheels +RUN pip download --only-binary=:all: --no-deps sgl-kernel==0.3.9.post2 -d /tmp/sgl_kernel_wheels # โ”€โ”€ ๆ”ถ้›†ๆ‰€ๆœ‰ wheel ๅˆฐ /wheels โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ RUN mkdir -p /wheels && \ @@ -109,11 +109,55 @@ RUN pip wheel "gradio==5.38.2" requests -w /wheels # ๆŠŠ่ฟ่กŒๆ—ถๆ‰€้œ€ไพ่ต–ไนŸๆ‰“ๅŒ…่ฟ›ๅ…ฅwheel โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ RUN pip wheel pybase64==1.3.2 -w /wheels + +# >>> ADD: ๅฏผๅ‡บ่ฝฎๅญ็š„็‹ฌ็ซ‹้˜ถๆฎต +FROM scratch AS wheelhouse +COPY --from=builder-extras /wheels / +# <<< END ADD + + +# >>> ADD: ไปŽๅฎฟไธปๆœบ็›ฎๅฝ• _wheelhouse/ ๅฎ‰่ฃ…่ฝฎๅญ็š„ runtime +ARG CUDA_VERSION=12.6.1 +FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 AS runtime-prebuilt + +ENV DEBIAN_FRONTEND=noninteractive PYTHONUNBUFFERED=1 LANG=C.UTF-8 LC_ALL=C.UTF-8 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc g++ build-essential ninja-build cuda-compiler-12-6 \ + python3 python3-dev python3-pip python3-distutils curl ca-certificates \ + libopenblas-dev libgomp1 libcupti-dev libnuma1 libopenmpi-dev openmpi-bin libnuma-dev libpng16-16 libjpeg8 \ + libnccl2=2.22.3-1+cuda12.6 && \ + rm -rf /var/lib/apt/lists/* && \ + python3 -m pip install --no-cache-dir --upgrade pip && \ + python3 -m pip install --no-cache-dir xgrammar + +# ๆ‹ท่ด cupti ๅŠจๆ€ๅบ“๏ผˆไธŽ autobuild ็›ธๅŒ๏ผ‰ +COPY --from=builder-extras /usr/local/cuda/lib64/libcupti.so.12 /usr/lib/x86_64-linux-gnu/ +COPY --from=builder-extras /usr/local/cuda/lib64/libcupti.so /usr/lib/x86_64-linux-gnu/ +RUN ldconfig + +# โ˜… ไปŽๅฎฟไธปๆœบๆž„ๅปบไธŠไธ‹ๆ–‡ๅคๅˆถๆœฌๅœฐ่ฝฎๅญ๏ผˆ็›ฎๅฝ•ๅๅ›บๅฎš๏ผš_wheelhouse/๏ผ‰ +COPY _wheelhouse/ /tmp/wheels/ + +# ๅฎ‰่ฃ…้กบๅบไธŽ runtime-autobuild ๅฎŒๅ…จไธ€่‡ด๏ผˆไผ˜ๅ…ˆ torch๏ผŒๅ†่ฃ…ๅ…ถๅฎƒ๏ผ‰ +RUN ls -lh /tmp/wheels || true && \ + rm -f /tmp/wheels/torch-2.7.1a0+*.whl && \ + rm -f /tmp/wheels/huggingface_hub-0.34.4*.whl || true && \ + python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/torch*.whl && \ + python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/vllm-*.whl || true && \ + python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/sgl_kernel-*.whl || true && \ + python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/gradio-5.38.2*.whl || true && \ + python3 -m pip install --no-cache-dir --no-deps $(find /tmp/wheels -maxdepth 1 -type f -name '*.whl' ! -name 'gradio-*' -printf "/tmp/wheels/%f ") && \ + python3 -c "import gradio, sys; print('โœ… Gradio version =', gradio.__version__)" && \ + rm -rf /tmp/wheels + + + ############################################################################### # Stage 2 โ”€ runtime๏ผšๆž็ฎ€่ฟ่กŒ้•œๅƒ๏ผŒไป…็ฆป็บฟๅฎ‰่ฃ… wheel ############################################################################### ARG CUDA_VERSION=12.6.1 -FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 +FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 AS runtime-autobuild ENV DEBIAN_FRONTEND=noninteractive PYTHONUNBUFFERED=1 LANG=C.UTF-8 LC_ALL=C.UTF-8 @@ -142,7 +186,7 @@ RUN ls -lh /tmp/wheels && \ python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/vllm-*.whl && \ python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/sgl_kernel-*.whl && \ python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/gradio-5.38.2*.whl && \ - python3 -m pip install --no-cache-dir --no-deps $(ls /tmp/wheels | grep -v '^gradio-' | sed 's|^|/tmp/wheels/|') && \ + # python3 -m pip install --no-cache-dir --no-deps $(ls /tmp/wheels | grep -v '^gradio-' | sed 's|^|/tmp/wheels/|') && \ python3 -m pip install --no-cache-dir --no-deps $(find /tmp/wheels -maxdepth 1 -type f -name '*.whl' ! -name 'gradio-*') && \ python3 -c "import gradio, sys; print('โœ… Gradio version =', gradio.__version__)" && \ rm -rf /tmp/wheels @@ -184,4 +228,6 @@ COPY ./meta_ui.py /app/meta_ui.py COPY ./supervisord.conf /etc/supervisor/supervisord.conf # ไฝœไธบๅฎนๅ™จไธป่ฟ›็จ‹่ฟ่กŒ supervisor -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] \ No newline at end of file +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] + +