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)
[0]: https://blog.davidv.dev/docker-based-images-on-baremetal.htm...