This commit is contained in:
hailin 2025-09-16 17:01:16 +08:00
parent 6fb59e0cf6
commit 0e0ab72b1c
1 changed files with 2 additions and 14 deletions

View File

@ -110,13 +110,12 @@ RUN pip wheel "gradio==5.38.2" requests -w /wheels
RUN pip wheel pybase64==1.3.2 -w /wheels RUN pip wheel pybase64==1.3.2 -w /wheels
# >>> ADD: 导出轮子的独立阶段 # 导出轮子的独立阶段
FROM scratch AS wheelhouse FROM scratch AS wheelhouse
COPY --from=builder-extras /wheels / COPY --from=builder-extras /wheels /
# <<< END ADD
# >>> ADD: 从宿主机目录 _wheelhouse/ 安装轮子的 runtime # 从宿主机目录 _wheelhouse/ 安装轮子的 runtime
ARG CUDA_VERSION=12.6.1 ARG CUDA_VERSION=12.6.1
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 AS runtime-prebuilt FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu22.04 AS runtime-prebuilt
@ -129,11 +128,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libnccl2=2.22.3-1+cuda12.6 && \ libnccl2=2.22.3-1+cuda12.6 && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
python3 -m pip install --no-cache-dir --upgrade pip 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 -p | grep -i cupti || (echo "no cupti"; exit 1) RUN ldconfig -p | grep -i cupti || (echo "no cupti"; exit 1)
RUN ldconfig RUN ldconfig
@ -168,11 +163,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ build-e
libopenblas-dev libgomp1 libcupti-dev libnuma1 libopenmpi-dev openmpi-bin libnuma-dev libpng16-16 libjpeg8 libnccl2=2.22.3-1+cuda12.6 && \ 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/* && \ rm -rf /var/lib/apt/lists/* && \
python3 -m pip install --no-cache-dir --upgrade pip python3 -m pip install --no-cache-dir --upgrade pip
# && python3 -m pip install --no-cache-dir xgrammar
# 👉 拷贝 cupti 动态库(避免写死版本号)
# 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/
# 检查 cupti 动态库 # 检查 cupti 动态库
RUN ldconfig -p | grep -i cupti || (echo "no cupti"; exit 1) RUN ldconfig -p | grep -i cupti || (echo "no cupti"; exit 1)
@ -180,8 +170,6 @@ RUN ldconfig -p | grep -i cupti || (echo "no cupti"; exit 1)
# 👇建议在后面补上 # 👇建议在后面补上
RUN ldconfig RUN ldconfig
#COPY --from=builder-extras /wheels /tmp/wheels
COPY _wheelhouse/ /tmp/wheels/ COPY _wheelhouse/ /tmp/wheels/
# ✅ 优先装你自编的 torch避免被 PyPI 上的覆盖 # ✅ 优先装你自编的 torch避免被 PyPI 上的覆盖