Kubespawner custom prespawn image

I have a pre_spawn_hook that requires the use of s3fs, but I can’t figure out how to modify the underlying image to install s3fs. I tried changing c.KubeSpawner.image to point to a custom singleuser image which installs s3fs, but this didn’t work.

If you can show us your full configuration and link to any Dockerfiles you’re using that might help us understand what the problem is.

Here is a minimal configuration override for the jupyterhub helm chart that would replicate the issue that I’m facing:

            myConfig: |
                c.KubeSpawner.image = "<CUSTOM IMAGE BASED ON jupyter/singleuser - but with s3fs installed>"
                async def pre_spawn_hook(spawner):
                  import s3fs
                c.Spawner.pre_spawn_hook = pre_spawn_hook

Results in module not found error s3fs on spawn.

I think that maybe I need to modify hub.image instead of KubeSpawner image: https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/f9ecaa8d117832387463c4096eac6fd2d03d8c3d/jupyterhub/values.yaml#L73 ?