FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu20.04 # These are all pre-defined ENV DEBIAN_FRONTEND=noninteractive \ TZ=Europe/Paris # Install some basic utilities RUN rm -f /etc/apt/sources.list.d/*.list && \ apt-get update && apt-get install -y --no-install-recommends \ sudo \ git \ curl \ wget \ ffmpeg libsm6 libxext6 \ && rm -rf /var/lib/apt/lists/* # Create a working directory WORKDIR /app # Create a non-root user and switch to it RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ && chown -R user:user /app \ && echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user USER user # All users can use /home/user as their home directory ENV HOME=/home/user \ CONDA_AUTO_UPDATE_CONDA=false ENV PATH=$HOME/miniconda/bin:$PATH RUN mkdir $HOME/.cache $HOME/.config \ && chmod -R 777 $HOME \ && curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py310_24.5.0-0-Linux-x86_64.sh \ && chmod +x ~/miniconda.sh \ && ~/miniconda.sh -b -p ~/miniconda \ && rm ~/miniconda.sh \ && conda clean -ya # Python packages RUN --mount=target=requirements.txt,source=requirements.txt \ pip install --no-cache-dir torch torchvision && \ pip install --no-cache-dir git+https://github.com/openai/CLIP.git && \ pip install --no-cache-dir -r requirements.txt # Download GLIP dependencies, but unfortunately don't install yet... RUN git clone https://github.com/sachit-menon/GLIP # Run gradio COPY --link --chown=1000 ./ /app EXPOSE 7860 ENV GRADIO_SERVER_NAME="0.0.0.0" CMD ["bash", "app.sh"]