span-02 / Dockerfile
lihe07's picture
span-02: single-source release folder (engine final path, soft blend)
4ec9a3b verified
Raw History Blame Contribute Delete
2.1 kB
# span-02 serving image: dllm-server (Rust/CUDA, sm_120a cubins for RTX 5090 / RTX PRO 6000 Blackwell) + launcher.
# Build from the root of this repo (the .dockerignore keeps the weights out of the build context):
# docker build -t span-02 .
# Run (downloads the weights and the MTP draft on first start; the volume keeps them):
# docker run --gpus all -p 8000:8000 -v span02-data:/data -e HF_TOKEN span-02
# or serve the weights of this clone: add -v "$PWD":/model:ro -e DLLM_MODEL_DIR=/model
# Host: NVIDIA driver with CUDA >= 12.9 support (R575+) and the NVIDIA container toolkit.
# ---- build stage: nvcc compiles the .cu kernels to sm_120a cubins (embedded in the binary); no GPU needed to build
FROM nvidia/cuda:12.9.1-devel-ubuntu24.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && apt-get install -y -qq curl build-essential pkg-config cmake nasm clang git ca-certificates >/dev/null && rm -rf /var/lib/apt/lists/*
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --default-toolchain 1.99.0
ENV PATH=/root/.cargo/bin:$PATH NVCC=/usr/local/cuda/bin/nvcc DLLM_CUDA_ARCH=120a
WORKDIR /src
COPY engine /src/engine
RUN cd /src/engine && cargo build --release -p dllm-server && cp target/release/dllm-server /usr/local/bin/dllm-server
# ---- runtime stage: the binary only needs the driver library (injected by the container toolkit)
FROM nvidia/cuda:12.9.1-base-ubuntu24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && apt-get install -y -qq python3 python3-venv ca-certificates curl >/dev/null && rm -rf /var/lib/apt/lists/* \
&& python3 -m venv /opt/hf && /opt/hf/bin/pip install -q huggingface_hub hf_transfer
ENV PATH=/opt/hf/bin:$PATH HF_HUB_ENABLE_HF_TRANSFER=1 DLLM_DATA=/data/dllm PORT=8000
COPY --from=build /usr/local/bin/dllm-server /usr/local/bin/dllm-server
# the Hub does not store the executable bit, so set it here (and run through bash, as the shebang says)
COPY launch.sh /usr/local/bin/dllm-launch
RUN chmod 755 /usr/local/bin/dllm-launch
EXPOSE 8000
ENTRYPOINT ["/bin/bash", "/usr/local/bin/dllm-launch"]