MFA-RUST / Dockerfile
YTShortMakerArchx's picture
Update Dockerfile
7f96697 verified
Raw History Blame Contribute Delete
1.53 kB
# Stage 1: Build Rust binary (fully static via musl — no GLIBC dependency)
FROM rust:1.85-slim as builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
musl-tools \
&& rm -rf /var/lib/apt/lists/* \
&& rustup target add x86_64-unknown-linux-musl
COPY Cargo.toml .
COPY main.rs .
COPY models.rs .
COPY utils.rs .
RUN cargo build --release --target x86_64-unknown-linux-musl
# Stage 2: Runtime with MFA
FROM condaforge/mambaforge:latest
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
MFA_ROOT_DIR=/mfa \
PATH=/env/bin:$PATH
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata ffmpeg libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Conda env + MFA
RUN mkdir -p /mfa && \
mamba create -p /env -c conda-forge -y \
montreal-forced-aligner \
python=3.11 && \
/env/bin/pip install --no-cache-dir \
praatio>=6.0 \
numpy && \
conda clean -afy
# Download models
RUN /env/bin/mfa model download acoustic english_mfa && \
/env/bin/mfa model download dictionary english_mfa
# Copy Rust binary (from musl target — fully static, no GLIBC needed)
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/mfa-aligner-rust /app/
# Copy Python worker
COPY --chown=root:root worker_mfa.py /app/worker_mfa.py
# Create user
RUN useradd -ms /bin/bash -u 1000 mfauser && \
chown -R 1000:1000 /mfa /env /app
USER 1000
WORKDIR /app
EXPOSE 7860
CMD ["./mfa-aligner-rust"]