# Dynamo-enabled B300 serving image.
#
# The sglang runtime tree inside the base image is byte-identical to
# b300/dynamo @ 8b67636010 (the only commits between the baked tree
# 433257c7b0 and 8b67636010 are deploy/docs), so this layer only swaps the
# preinstalled Dynamo 1.6.0.dev snapshot for the released 1.6.2 runtime.
#
# Build:
#   docker build -t ymkymx/sglang:dynamo-8b6763601-baked-20261117 .
# or use ./build-dynamo-image.sh (also imports into containerd).

ARG BASE=ymkymx/sglang:recipe-ns-l3ssd-433257c7b-baked-20261115
FROM ${BASE}

ARG DYNAMO_VERSION=1.6.2
ARG PIP_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple

LABEL ai.sglang.build.commit="8b67636010e54fc96e5aeba9b0139b38aa18b000"
LABEL ai.dynamo.version="${DYNAMO_VERSION}"
LABEL org.opencontainers.image.description="SGLang B300 (b300/dynamo) + NVIDIA Dynamo ${DYNAMO_VERSION}"

# --no-deps: the base image already carries the full runtime dependency set
# (torch 2.14.1, ai-dynamo deps, nixl 1.5.0). Resolving would try to pull
# sglang==0.5.19 from the `sglang` extra and downgrade torch.
RUN pip uninstall -y ai-dynamo ai-dynamo-runtime >/dev/null 2>&1 || true \
 && pip install --no-cache-dir --no-deps -i "${PIP_INDEX}" \
        "ai-dynamo==${DYNAMO_VERSION}" "ai-dynamo-runtime==${DYNAMO_VERSION}"

# CPU-only smoke: both CLIs must import the sglang args we build from source.
RUN python - <<'PY'
import importlib.metadata as m
import sglang
import dynamo.sglang  # noqa: F401
import dynamo.frontend  # noqa: F401
print("dynamo", m.version("ai-dynamo"), "runtime", m.version("ai-dynamo-runtime"))
print("sglang", sglang.__file__)
PY
RUN python -m dynamo.sglang --help >/dev/null && python -m dynamo.frontend --help >/dev/null

ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh"]
CMD []
