Some updates on that topic @choldgraf,
You can check here the latest developement:
First we have a bash file that is responsible for getting the proper metadata, if checks pass (config exists and/or book alreay built) the jupyter-book build process is launched.
This process lives just before a user starts his session, possible thanks to latest jupyterhub changes:
The cluster can be then upgraded with:
sudo helm upgrade (...) --set-file jupyterhub.singleuser.extraFiles.jb_build.stringData=./jb_build.bash (...)
Hope that this will help!
PS: Ideally I would like to use an initContainer, but I cannot because of this binder url request accessible to hub singleuser initContainers · Issue #1429 · jupyterhub/binderhub · GitHub
Even better if this process is done just once after docker build https://github.com/jupyterhub/binderhub/pull/1081