l
File size: 1,906 Bytes
2dbc437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# ── Base image ────────────────────────────────────────────────────────
FROM python:3.10-slim

# ── System deps (audio libs required by TTS / soundfile) ──────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        libsndfile1 \
        ffmpeg \
        git \
    && rm -rf /var/lib/apt/lists/*

# ── HuggingFace Spaces: non-root user uid=1000 ────────────────────────
RUN useradd -m -u 1000 user
USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    # Accept Coqui TOS automatically
    COQUI_TOS_AGREED=1 \
    # Keep HF model cache inside the container's writable home
    HF_HOME=/home/user/.cache/huggingface \
    # Avoid tokeniser parallelism warnings
    TOKENIZERS_PARALLELISM=false

WORKDIR $HOME/app

# ── Python deps ───────────────────────────────────────────────────────
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt

# ── App code ─────────────────────────────────────────────────────────
COPY --chown=user app.py .

# ── Runtime dirs (writable by user 1000) ─────────────────────────────
RUN mkdir -p /home/user/app/voice_library /home/user/app/outputs

# ── HuggingFace Spaces listens on 7860 ───────────────────────────────
EXPOSE 7860

CMD ["python", "app.py"]