FROM python:3.10-slim # Install system dependencies as root RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y ffmpeg # Create a non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /app COPY --chown=user requirements.txt . COPY --chown=user app.py . RUN pip install --no-cache-dir -r requirements.txt torch torchaudio whisper RUN python -c "import whisper; whisper.load_model('base')" EXPOSE 7860 CMD ["python", "-u", "app.py"]