How to mount persistent disk to HF Spaces In Docker?

The new persistent storage seems fantastic. How do I mount the storage into the Docker container on spaces? An update to the documentation would be welcome here!

hi @hamel, thanks for the feedback, we’ll improve the docs.

Unfortunately, at moment, /data/ is not available at Docker build time, we’re looking into improve that DX cc @chris-rannou

Here is an example how I use it on a Dockerfile, by exporting the huggingface-hub env HF_HOME to point to the /data/ , so in this example new downloaded models will be cached across rebuilds

ENV  HF_HOME=/data/.huggingface 

Another useful workaround, since the data files are not on the UI yet, if you ever need, this is using nginx proxying the main web service in addition to a simple autoindex on the /data/ folder. Please ignore the ComfyUI setup steps.

Dockerfile - Dockerfile · radames/ComfyUI-data-index at main
Nginx - nginx.conf · radames/ComfyUI-data-index at main