How to deal with no GPU during docker build time

Hey, i ran into an issue with new docker image support on spaces … and not sure, if this is standard behaviour, or specific to HF.

I am building an app that needs neural_renderer. When i add this requirement to the Dockerfile it fails during build with No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'. After some trial-error i figured that i can install neural renderer after app start.

So i assume that there is no GPU backing during docker build time and it only becomes available after container start. Sounds like a common problem … or am i missing something obvious?

My original question on HF Discord:

Here is some info from NVIDIA: Advanced topics · NVIDIA/nvidia-docker Wiki · GitHub

Seems like my assumption is right and there is no GPU avail during docker build. So my question to the HF team is: how can one deal with that?

Here is a howto for a NVIDIA GPU-backed runtime. This allows one to build the container image on your local system (or any other GPU system), submit it to Docker hub and then inherit from there during build on HF.