Spaces:
Running
Running
| FROM python:3.10-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DEFAULT_TIMEOUT=600 \ | |
| PIP_RETRIES=20 \ | |
| OMP_NUM_THREADS=2 \ | |
| MKL_NUM_THREADS=2 \ | |
| NUMBA_CACHE_DIR=/tmp/numba_cache \ | |
| XDG_CACHE_HOME=/tmp/hf_cache \ | |
| TORCH_HOME=/tmp/hf_cache/torch \ | |
| WHISPER_CACHE_DIR=/tmp/hf_cache/whisper | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends ffmpeg git && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir "setuptools<81" wheel | |
| RUN pip install --no-cache-dir torch --extra-index-url https://download.pytorch.org/whl/cpu | |
| RUN pip install --no-cache-dir --no-build-isolation openai-whisper==20240930 | |
| COPY requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| RUN useradd -m -u 1000 user | |
| RUN mkdir -p /tmp/hf_cache/torch /tmp/hf_cache/whisper /tmp/numba_cache && \ | |
| chmod -R 777 /tmp/hf_cache /tmp/numba_cache | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| COPY --chown=user app.py . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |