FROM nvidia/cuda:11.6.1-cudnn8-devel-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ libgl1 \ freeglut3-dev \ unzip \ ffmpeg \ libsm6 \ libxext6 \ libgl1-mesa-dri \ libegl1-mesa \ libgbm1 \ build-essential \ libeigen3-dev \ python3.8 \ python3-pip \ nvidia-cuda-toolkit # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user FROM python:3.8 ENV PYTHONUNBUFFERED=1 ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6" ENV TCNN_CUDA_ARCHITECTURES=86;80;75;70;61;60 ENV FORCE_CUDA=1 ENV CUDA_HOME=/usr/local/cuda ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:/usr/bin:${PATH} ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} # Set home to the user's home directory ENV HOME=/home/user \ PYTHONPATH=$HOME/app \ PYTHONUNBUFFERED=1 \ GRADIO_ALLOW_FLAGGING=never \ GRADIO_NUM_PORTS=1 \ GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_THEME=huggingface \ SYSTEM=spaces RUN pip install --upgrade pip ninja RUN pip install setuptools==69.5.1 COPY requirements.txt /tmp RUN cd /tmp && pip install -r requirements.txt RUN pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu116_pyt1130/download.html RUN python -c "import torch; print(torch.version.cuda)" # Set the working directory to the user's home directory WORKDIR $HOME/app # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app CMD ["python", "app.py"]