YTShortMakerArchx commited on
Commit
accfd43
·
verified ·
1 Parent(s): 00b3d50

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build Rust binary
2
+ FROM rust:1.75-slim as builder
3
+
4
+ WORKDIR /app
5
+ COPY Cargo.toml .
6
+ COPY main.rs .
7
+ COPY models.rs .
8
+ COPY utils.rs .
9
+
10
+ RUN cargo build --release
11
+
12
+ # Stage 2: Runtime with MFA
13
+ FROM condaforge/mambaforge:latest
14
+
15
+ ENV DEBIAN_FRONTEND=noninteractive \
16
+ TZ=Etc/UTC \
17
+ MFA_ROOT_DIR=/mfa \
18
+ PATH=/env/bin:$PATH
19
+
20
+ # System deps
21
+ RUN apt-get update && apt-get install -y --no-install-recommends \
22
+ tzdata ffmpeg libsndfile1 \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Conda env + MFA
26
+ RUN mkdir -p /mfa && \
27
+ mamba create -p /env -c conda-forge -y \
28
+ montreal-forced-aligner \
29
+ python=3.11 && \
30
+ /env/bin/pip install --no-cache-dir \
31
+ praatio>=6.0 \
32
+ numpy && \
33
+ conda clean -afy
34
+
35
+ # Download models
36
+ RUN /env/bin/mfa model download acoustic english_mfa && \
37
+ /env/bin/mfa model download dictionary english_mfa
38
+
39
+ # Copy Rust binary
40
+ COPY --from=builder /app/target/release/mfa-aligner-rust /app/
41
+
42
+ # Copy Python worker
43
+ COPY --chown=root:root worker_mfa.py /app/worker_mfa.py
44
+
45
+ # Create user
46
+ RUN useradd -ms /bin/bash -u 1000 mfauser && \
47
+ chown -R 1000:1000 /mfa /env /app
48
+
49
+ USER 1000
50
+ WORKDIR /app
51
+
52
+ EXPOSE 7860
53
+
54
+ CMD ["./mfa-aligner-rust"]