# Use the NVIDIA CUDA runtime as a base image FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04 # Set environment variables ENV DEBIAN_FRONTEND=noninteractive RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=$HOME/app \ PYTHONUNBUFFERED=1 \ GRADIO_ALLOW_FLAGGING=never \ GRADIO_NUM_PORTS=1 \ GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_THEME=huggingface \ GRADIO_SHARE=False \ SYSTEM=spaces # Set the working directory to the user's home directory WORKDIR $HOME/app # Install system dependencies as root USER root RUN apt-get update && apt-get install -y --no-install-recommends \ git \ cmake \ build-essential \ libgl1-mesa-glx \ libglib2.0-0 \ ffmpeg \ python3.8 \ python3-pip \ python3.8-dev \ && rm -rf /var/lib/apt/lists/* # Set Python 3.8 as the default python and pip versions RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 USER user # Clone the repository (adjust the URL if needed) RUN git clone --recursive https://github.com/jnjaby/KEEP.git . # Copy the app.py script into the container COPY app.py . COPY requirements_HF.txt . # Install Python dependencies from requirements.txt RUN pip install --upgrade pip RUN pip install -r requirements_HF.txt RUN pip install gradio RUN pip install cupy==10.4.0 USER root # Install basicsr (assuming setup.py is in basicsr directory) RUN python basicsr/setup.py develop USER user # Install additional Python packages RUN pip install ffmpeg-python RUN pip install dlib # Set the environment variable to specify the GPU device ENV CUDA_DEVICE_ORDER=PCI_BUS_ID ENV CUDA_VISIBLE_DEVICES=0 # Command to run your application CMD ["python", "app.py"]