From 0ba0c295ae487faace38f351d75621ee6f823e09 Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 19 Sep 2025 14:18:19 +0800 Subject: [PATCH] . --- Dockerfile | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e6ef4896..6e2d70463 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,17 +83,6 @@ RUN python3 -m pip install --no-cache-dir numpy requests build "cuda-python>=12. ls -lh dist/ - # ── 下载 vllm 预编译 wheel,避免编译 flash-attn ─────────────────────────────── -WORKDIR /opt -RUN pip download --only-binary=:all: --no-deps vllm==0.9.1 -d /tmp/vllm_wheels - - -# ── 编译你本地 sglang 源码并打 wheel ─────────────────────────────────────── -COPY ./sglang /sgl/sglang -WORKDIR /sgl/sglang/python -RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \ - python3 -m pip wheel ".[srt,openai]" --no-deps -w /tmp/sg_wheels - # # ── 🔄 下载 sgl-kernel(与 sglang 同步)─────────────────────────────────────── # RUN pip download --only-binary=:all: --no-deps sgl-kernel==0.3.9.post2 -d /tmp/sgl_kernel_wheels @@ -131,6 +120,30 @@ RUN python3 -m pip install --no-cache-dir "cmake>=3.27,<4.0" scikit-build-core== ' +# ★ 生成 constraints,强制 sgl-kernel 只能用本地 wheel +RUN bash -lc 'set -e; \ + WHEEL=$(ls /tmp/sgl_kernel_wheels/sgl_kernel-*.whl | head -n1); \ + echo "sgl-kernel @ file://$WHEEL" > /tmp/sgl_constraints.txt; \ + echo ">>> Using constraint:"; cat /tmp/sgl_constraints.txt' + + +RUN python3 -m pip install --no-cache-dir --no-deps /tmp/sgl_kernel_wheels/sgl_kernel-*.whl + + +# ── 下载 vllm 预编译 wheel,避免编译 flash-attn ─────────────────────────────── +WORKDIR /opt +RUN pip download --only-binary=:all: --no-deps vllm==0.9.1 -d /tmp/vllm_wheels + + +# ── 编译你本地 sglang 源码并打 wheel ─────────────────────────────────────── +COPY ./sglang /sgl/sglang +# WORKDIR /sgl/sglang/python +# RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \ +# python3 -m pip wheel ".[srt,openai]" --no-deps -w /tmp/sg_wheels +WORKDIR /sgl/sglang/python +RUN python3 -m pip install --no-build-isolation -c /tmp/sgl_constraints.txt ".[srt,openai]" && \ + python3 -m pip wheel --no-build-isolation -c /tmp/sgl_constraints.txt ".[srt,openai]" -w /tmp/sg_wheels + # ── 收集所有 wheel 到 /wheels ────────────────────────────────────────────── RUN mkdir -p /wheels && \