CoolFace
Apppublic

montreal-forced-align-polygot/MFA-python

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
Dockerfile47 linesDownload Raw Back to root
1FROM condaforge/mambaforge:latest2 3ENV DEBIAN_FRONTEND=noninteractive \4    TZ=Etc/UTC \5    MFA_ROOT_DIR=/mfa \6    PATH=/env/bin:$PATH7 8# ── System deps ───────────────────────────────────────────────────────────────9RUN apt-get update && apt-get install -y --no-install-recommends \10    tzdata ffmpeg libsndfile1 \11    && rm -rf /var/lib/apt/lists/*12 13# ── Conda env + Python deps ───────────────────────────────────────────────────14RUN mkdir -p /mfa && \15    mamba create -p /env -c conda-forge -y \16        montreal-forced-aligner \17        python=3.11 && \18    /env/bin/pip install --no-cache-dir \19        fastapi==0.115.0 \20        "uvicorn[standard]==0.30.6" \21        pydantic>=2.0 \22        praatio>=6.0 \23        numpy && \24    conda clean -afy25 26# ── Download models once — baked into image ───────────────────────────────────27RUN /env/bin/mfa model download acoustic english_mfa && \28    /env/bin/mfa model download dictionary english_mfa29 30# ── Pre-extract acoustic model zip so MFA never unzips at runtime ─────────────31# Write the script to a file first — avoids Dockerfile parser misreading32# "from montreal_forced_aligner..." as a FROM instruction.33COPY preextract.py /tmp/preextract.py34RUN /env/bin/python /tmp/preextract.py || echo "Pre-extraction failed (non-fatal)"35 36# ── HF Spaces requires UID 1000 ───────────────────────────────────────────────37RUN useradd -ms /bin/bash -u 1000 mfauser && \38    chown -R 1000:1000 /mfa /env39 40# NOTE: /dev/shm is a runtime tmpfs — app.py creates /dev/shm/mfa_work at startup.41 42USER 100043WORKDIR /app44COPY --chown=1000:1000 app.py /app/app.py45 46EXPOSE 786047CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]