FROM python:3.10-slim # Install system dependencies: # ffmpeg → required by ctc-forced-aligner # build-essential → compilers (g++, make) for the C++ extension # git → needed to pip install from GitHub RUN apt-get update && \ apt-get install -y ffmpeg build-essential git && \ rm -rf /var/lib/apt/lists/* # ----- Redirect all caches to /tmp (mandatory for HF Spaces) ----- ENV NUMBA_CACHE_DIR=/tmp/numba_cache ENV MPLCONFIGDIR=/tmp/matplotlib_cache ENV XDG_CACHE_HOME=/tmp/xdg_cache ENV HF_HOME=/tmp/hf_cache ENV TRANSFORMERS_CACHE=/tmp/hf_cache/transformers ENV TORCH_HOME=/tmp/hf_cache/torch ENV HF_HUB_CACHE=/tmp/hf_cache/hub RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \ chmod -R 777 /tmp/hf_cache WORKDIR /code COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 7860 # Adjust the module name if your Python file is named app.py (app:app) CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]FROM python:3.10-slim # Install system dependencies: # ffmpeg → required by ctc-forced-aligner # build-essential → compilers (g++, make) for the C++ extension # git → needed to pip install from GitHub RUN apt-get update && \ apt-get install -y ffmpeg build-essential git && \ rm -rf /var/lib/apt/lists/* # ----- Redirect all caches to /tmp (mandatory for HF Spaces) ----- ENV NUMBA_CACHE_DIR=/tmp/numba_cache ENV MPLCONFIGDIR=/tmp/matplotlib_cache ENV XDG_CACHE_HOME=/tmp/xdg_cache ENV HF_HOME=/tmp/hf_cache ENV TRANSFORMERS_CACHE=/tmp/hf_cache/transformers ENV TORCH_HOME=/tmp/hf_cache/torch ENV HF_HUB_CACHE=/tmp/hf_cache/hub RUN mkdir -p ${TRANSFORMERS_CACHE} ${TORCH_HOME} && \ chmod -R 777 /tmp/hf_cache WORKDIR /code COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 7860 # Adjust the module name if your Python file is named app.py (app:app) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]