# Use CUDA 12.4 with Ubuntu 22.04 FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 # Avoid prompts during installation ENV DEBIAN_FRONTEND=noninteractive\ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PIP_BREAK_SYSTEM_PACKAGES=1 # Install System Dependencies: Python, Git, FFmpeg RUN apt-get update && apt-get install -y \ python3.10 \ python3-pip \ ffmpeg \ git \ && rm -rf /var/lib/apt/lists/* # Set up a non-root user for Hugging Face security RUN useradd -m -u 1000 user || echo "User already exists" RUN mkdir -p /home/user/app && chown -R 1000:1000 /home/user USER 1000 ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy requirements first to leverage Docker cache COPY --chown=user requirements.txt $HOME/app/requirements.txt RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel RUN python3 -m pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of your application code COPY --chown=user . . # Expose the default HF Port EXPOSE 7860 # Run the app (assumes your entry script is called app.py) CMD ["python3", "app.py"]