File size: 1,026 Bytes
139a7e3
 
 
 
 
f7ffb94
139a7e3
 
 
 
 
 
 
 
ced74e5
2419464
ced74e5
139a7e3
2419464
ced74e5
a0a22d0
 
 
ced74e5
b7b963f
f7ffb94
 
a0a22d0
ced74e5
139a7e3
ced74e5
139a7e3
 
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
FROM python:3.10-slim

RUN apt-get update && apt-get install -y \
    espeak-ng \
    wget \
    g++ \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# 1. Copy requirements and voices list first
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY --chown=user voices.txt .
# 2. Download models directly into the models folder
RUN while read -r voice; do \
      echo "Downloading: $voice"; \
      wget -q -nd "https://huggingface.co/rhasspy/piper-voices/resolve/main/$voice" -P models/ || exit 1; \
    done < voices.txt

RUN wget -q "https://huggingface.co/gweltou/breton-tts/resolve/main/model.onnx" -O models/breton-model.onnx && \
    wget -q "https://huggingface.co/gweltou/breton-tts/resolve/main/tokens.txt" -O models/breton-tokens.txt
    
# 3. Copy the rest of the app
COPY --chown=user . .

EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]