# syntax=docker/dockerfile:1.7
# GLM-5.3-Flash NVFP4-4p67 (local-inference-lab fidelity quant) on DGX Spark.
#
# FROM the proven lab image (day-0 base + NoPE-MLA + FujitsuPolycom patches —
# which already carry the W4A16_NVFP4 / MIXED_PRECISION / MXFP8 modelopt
# methods this quant needs) and add ONE structural fix: glm5next model-class
# `packed_modules_mapping` declarations (model.py + mtp.py). 4p67 is the
# first glm5next checkpoint with QUANTIZED attention projections; without
# the shard mapping the fused KDA/MLA/indexer linears load unquantized and
# weight loading dies on `in_proj_qkvbfg_a.weight_scale`.
# Provenance: mirrors the fork dev/jovian-judgement resolution path
# (local-inference-lab/vllm, Apache-2.0) without porting the restructured
# package (which hard-depends on the amd64-only b12x backend).

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

COPY patch_4p67.py /tmp/patch_4p67.py

RUN set -eux; \
    python3 /tmp/patch_4p67.py; \
    rm -f /tmp/patch_4p67.py
