# Use an official PyTorch image with CUDA support as the base image FROM pytorch/pytorch:1.9.01-cuda11.1-cudnn8-runtime # Install Git, OpenGL libraries, and libglib2.0 RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0 # Install necessary dependencies, including CMake, a C++ compiler, and others RUN apt-get update && apt-get install -y unzip ffmpeg cmake g++ build-essential aria2 # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set environment variables ENV HOME=/home/user \ CUDA_HOME=/usr/local/cuda \ PATH=/home/user/.local/bin:$PATH \ LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \ LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_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 # Clone your repository or add your code to the container RUN git clone -b main https://github.com/fffiloni/video-retalking $HOME/app # Install specific versions of PyTorch and TorchVision RUN pip install torch==1.9.0 torchvision==0.10.0 # Install dependencies COPY requirements.txt $HOME/app/requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Download checkpoint files using aria2 RUN aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/camenduru/video-retalking/resolve/main/30_net_gen.pth -d $HOME/app/checkpoints -o 30_net_gen.pth # Continue with the other aria2c download commands # Unzip BFM.zip RUN unzip -d $HOME/app/checkpoints/BFM $HOME/app/checkpoints/BFM.zip # Ensure the compiled CUDA code can be found ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} # Update package lists and install other dependencies as needed # Ensure that CUDA components are correctly installed and configured # Install any other required packages # Set the environment variable to specify the GPU device ENV CUDA_DEVICE_ORDER=PCI_BUS_ID ENV CUDA_VISIBLE_DEVICES=0 # Run your app.py script CMD ["python", "app.py"]