FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ curl \ git \ wget \ freeglut3-dev \ unzip \ ffmpeg \ libsm6 \ libxext6 \ libgomp1 \ libfontconfig1 \ libgl1-mesa-glx \ libgl1-mesa-dev \ libglfw3 \ libglfw3-dev \ libglew2.1 \ libglew-dev \ mesa-utils \ libc6 \ libxdamage1 \ libxfixes3 \ libxcb-glx0 \ libxcb-dri2-0 \ libxcb-dri3-0 \ libxcb-present0 \ libxcb-sync1 \ libxshmfence1 \ libxxf86vm1 \ libxrender1 \ libgbm1 \ build-essential \ libeigen3-dev \ python3.8 \ python3-pip \ python-is-python3 \ nvidia-cuda-toolkit \ && rm -rf /var/lib/apt/lists/* # 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 # Set the environment variable to specify the GPU device ENV CUDA_HOME=/usr/local/cuda # ENV CUDA_DEVICE_ORDER=PCI_BUS_ID # ENV CUDA_VISIBLE_DEVICES=0 ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:/usr/bin:${PATH} ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:/usr/lib:/usr/lib64:${LD_LIBRARY_PATH} # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=$HOME/app:$PYTHONPATH \ 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 RUN pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html RUN python -c "import torch, os; print(torch.version.cuda); print(os.environ.get('CUDA_HOME'))" COPY requirements.txt /tmp RUN cd /tmp && pip install -r requirements.txt RUN pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl RUN pip install https://download.is.tue.mpg.de/icon/HF/pytorch3d-0.7.0-cp38-cp38-linux_x86_64.whl RUN pip install pyembree ENV TRANSFORMERS_CACHE=/tmp ENV MPLCONFIGDIR=/tmp # cannot cache function '_make_tree': no locator available for file '/usr/local/lib/python3.8/site-packages/pymatting/util/kdtree.py' ENV NUMBA_CACHE_DIR=/tmp/numba_cache ENV HF_HOME=$HOME/.cache/huggingface RUN mkdir -p $HF_HOME RUN chmod 777 -R $HOME # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # Set the working directory to the user's home directory WORKDIR $HOME/app ENV DISPLAY=:0 CMD ["python", "app.py"]