# scripts/iso/Dockerfile.assistant — the build host for the Felhom bare-metal ISO pipeline (R-21).
#
# Debian trixie == PVE 9.x codename; the proxmox-auto-install-assistant is pinned to the ISO
# generation by installing it from the PVE no-subscription repo of the ISO's Debian codename
# (spike SPIKE-baremetal-iso-2026-07-16.md §15.6: pair by major.minor). Rebuild this image when the
# target PVE generation changes (e.g. PVE 10 -> Debian forky) and record both versions in the build
# manifest.
#
# Build:  docker build -f scripts/iso/Dockerfile.assistant -t felhom-iso-assistant:trixie scripts/iso
FROM debian:trixie

# xorriso: ISO (re-)mastering. shellcheck: lint. grub-mkimage (+ x86_64-efi module dir) and mtools:
# the slice-B mkimage loader surgery — build a monolithic UEFI loader from the ISO's own GRUB modules
# and inject it into the efi.img ESP (FAT, via mtools). grub 2.12 on trixie == the PVE 9.x ISO's
# 2.12-9+pmx2 generation, so the tool matches the modules it embeds. imagemagick: the R-38 GRUB boot
# card — grub/generate-grub-background.sh letterboxes the website's brand asset onto a 1024x768
# gfxterm canvas at repack time, so the boot screen has ONE source (the website asset) and not a
# second pre-rendered copy checked into the repo to drift. python3: felhom-bootstrap.sh's JSON
# parsing depends on it on the installed box (PVE ships it) — the test harness
# (test/bootstrap-modes.sh) runs the bootstrap in THIS image, so it must match that dependency.
RUN apt-get update && apt-get install -y --no-install-recommends \
        ca-certificates wget gnupg xorriso shellcheck python3 \
        grub-common grub-efi-amd64-bin mtools dosfstools imagemagick \
    && rm -rf /var/lib/apt/lists/*

# PVE 9.x (trixie) no-subscription repo — pairs the assistant to the 9.2 ISO generation.
RUN wget -q https://enterprise.proxmox.com/debian/proxmox-release-trixie.gpg \
        -O /etc/apt/trusted.gpg.d/proxmox-release-trixie.gpg
RUN echo "deb http://download.proxmox.com/debian/pve trixie pve-no-subscription" \
        > /etc/apt/sources.list.d/pve.list

RUN apt-get update && apt-get install -y --no-install-recommends \
        proxmox-auto-install-assistant \
    && rm -rf /var/lib/apt/lists/*
