# Llama 4 Scout / Maverick on Iluvatar BI-V150
#
# 一个镜像同时支持：
#   - Llama-4-Scout-17B-16E-Instruct（BF16，TP8，8 卡）
#   - Llama-4-Maverick-17B-128E-Instruct-FP8（FP8，TP8+PP2，16 卡）
#
# 镜像只包含运行时依赖和 Llama 4 补丁，不设置启动命令、ENV、WORKDIR 或 EXPOSE；
# 模型路径、端口、TP/PP、GPU、挂载等全部由 run.sh / docker-compose.yml 在启动时传入。
#
# 构建：
#   docker build -t llama4-bi150:2026-10-26 .
#
# 运行（由 run.sh 传入 entrypoint 和全部参数）：
#   ./run.sh /mnt/disk0/models/LLM-Research/Llama-4-Scout-17B-16E-Instruct
#   ./run.sh /mnt/disk0/models/LLM-Research/Llama-4-Maverick-17B-128E-Instruct-FP8
#
# 补丁是针对下面这个精确基础镜像生成的；换基础镜像需要重新生成 diff。
#   registry.iluvatar.com.cn:10443/customer/sz/vllm0.17.0-4.4.0-x86:v7
#   (vLLM 0.17.0+corex.20260612070235)

FROM registry.iluvatar.com.cn:10443/customer/sz/vllm0.17.0-4.4.0-x86:v7

ARG IMAGE_VERSION=2026-10-26

LABEL org.opencontainers.image.title="llama4-bi150" \
      org.opencontainers.image.description="Llama 4 Scout / Maverick on Iluvatar BI-V150 with vLLM 0.17.0+corex" \
      org.opencontainers.image.version="${IMAGE_VERSION}"

COPY patches /opt/llama4/patches
COPY apply_patch.py /opt/llama4/apply_patch.py
COPY detect_model.py /opt/llama4/detect_model.py
COPY entrypoint.sh /usr/local/bin/llama4-entrypoint.sh

RUN chmod +x /usr/local/bin/llama4-entrypoint.sh \
    && chmod +x /opt/llama4/detect_model.py \
    && python3 /opt/llama4/apply_patch.py

# 故意不设置 ENV / WORKDIR / EXPOSE / ENTRYPOINT / CMD：
# 镜像保持通用，启动方式由 run.sh 或 docker-compose.yml 决定。
