This commit is contained in:
hailin 2025-07-03 21:16:33 +08:00
parent dc71fc4eb6
commit 4e1070db67
1 changed files with 17 additions and 3 deletions

View File

@ -85,13 +85,22 @@ WORKDIR /sgl/sglang/python
RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \ RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \
python3 -m pip wheel ".[srt,openai]" --no-deps -w /tmp/sg_wheels python3 -m pip wheel ".[srt,openai]" --no-deps -w /tmp/sg_wheels
# ── 收集所有 wheel 到 /wheels ────────────────────────────────────────────── # ── 收集所有 wheel 到 /wheels ──────────────────────────────────────────────
RUN mkdir -p /wheels && \ RUN mkdir -p /wheels && \
cp /tmp/torch_dist/torch*.whl /wheels/ && \ cp /tmp/torch_dist/torch*.whl /wheels/ && \
cp /opt/vision/dist/torchvision-*.whl /wheels/ && \ cp /opt/vision/dist/torchvision-*.whl /wheels/ && \
cp /opt/flashinfer/dist/flashinfer_python-*.whl /wheels/ && \ cp /opt/flashinfer/dist/flashinfer_python-*.whl /wheels/ && \
cp /tmp/vllm_wheels/vllm-*.whl /wheels/ && \ cp /tmp/vllm_wheels/vllm-*.whl /wheels/ && \
cp /tmp/sg_wheels/sglang-*.whl /wheels/ cp /tmp/sg_wheels/sglang-*.whl /wheels/ && \
pip wheel filelock typing-extensions sympy fsspec jinja2 networkx -w /wheels
# ── ✅ 再打包 runtime 阶段必需依赖 ────────────────────────────────────────────
RUN pip wheel \
pydantic orjson psutil pyzmq pynvml \
transformers==4.48.3 uvicorn fastapi IPython aiohttp \
setproctitle uvloop sentencepiece triton \
-w /wheels
############################################################################### ###############################################################################
# Stage 2 ─ runtime极简运行镜像仅离线安装 wheel # Stage 2 ─ runtime极简运行镜像仅离线安装 wheel
@ -123,8 +132,13 @@ RUN python3 -m pip install --no-cache-dir /tmp/wheels/torch*.whl && \
python3 -c "from torch.distributed import Backend; print('✅ Runtime torch distributed OK, GLOO =', Backend.GLOO)" && \ python3 -c "from torch.distributed import Backend; print('✅ Runtime torch distributed OK, GLOO =', Backend.GLOO)" && \
rm -rf /tmp/wheels rm -rf /tmp/wheels
# 安装运行时漏掉的依赖 # # 安装运行时漏掉的依赖
RUN python3 -m pip install --no-cache-dir pydantic orjson psutil pyzmq pynvml transformers==4.48.3 uvicorn fastapi IPython aiohttp setproctitle uvloop sentencepiece triton # RUN python3 -m pip install --no-cache-dir pydantic orjson psutil pyzmq pynvml transformers==4.48.3 uvicorn fastapi IPython aiohttp setproctitle uvloop sentencepiece triton
# ✅ 离线安装全部依赖(包含所有运行时必需包)
RUN python3 -m pip install --no-cache-dir /tmp/wheels/* && \
python3 -c "from torch.distributed import Backend; print('✅ Runtime torch distributed OK, GLOO =', Backend.GLOO)" && \
rm -rf /tmp/wheels
# ✅ 添加 Tini推荐 # ✅ 添加 Tini推荐
ENV TINI_VERSION=v0.19.0 ENV TINI_VERSION=v0.19.0