FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip python3-dev \ ffmpeg wget curl ca-certificates \ build-essential git libsndfile1 \ espeak-ng libespeak-ng1 \ && rm -rf /var/lib/apt/lists/* RUN ln -sf /usr/bin/python3 /usr/bin/python # --- Create non-root user (HF Spaces convention) --- RUN useradd -m -u 1000 user USER user ENV HOME=/home/user ENV PATH=/home/user/.local/bin:$PATH WORKDIR /home/user/app # --- Python deps --- COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # --- App code --- COPY --chown=user:user . . EXPOSE 7860 CMD ["python", "app.py"]