Spaces:
Running
Running
File size: 908 Bytes
946b6aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# ffmpeg is required to extract audio from uploaded videos
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg git \
&& rm -rf /var/lib/apt/lists/*
# Run as a non-root user (recommended for Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/home/user/.cache/huggingface
WORKDIR $HOME/app
# Install dependencies first for better layer caching
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Pre-download the Whisper model at build time so the first run is fast
RUN python -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-base')"
COPY --chown=user . .
EXPOSE 7860
CMD ["python", "app.py"]
|