TTS / Dockerfile
randusertry's picture
Update Dockerfile
f7ffb94 verified
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"]