I wrote down the kernel of the idea quite a while ago here[0], however, the actual version we run nowadays is using UEFI and written in Go (installer) + Python (API that generates the ISO on demand)
Fly.io[1] also does this (although they boot the result in a VM, the concepts are the same)
Any hints about how to do this? I'd love to use something as nice to work with as a Dockerfile to build bare metal installs.