FROM python:3.11-slim RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg curl git \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download Whisper base model at build time so runtime never hangs # Model is cached to ~/.cache/whisper by default RUN python -c "import whisper; whisper.load_model('base')" WORKDIR /app COPY app.py . RUN useradd -m -u 1000 appuser && \ mkdir -p /home/appuser/.cache && \ cp -r /root/.cache/whisper /home/appuser/.cache/whisper && \ chown -R appuser:appuser /app /home/appuser/.cache USER appuser EXPOSE 7860 CMD ["python", "app.py"]