Files
2026-10-12 02:12:30 +02:00

31 lines
1.3 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Piper-TTS hinter dem OpenAI-kompatiblen knaster-TTS-Dienst. Build-Kontext: Repo-Wurzel.
# Hinweis: piper-tts ab 1.3 ist GPL-3.0 – läuft hier als eigenständiger Dienst.
FROM python:3.12-slim
ARG PIPER_VERSION=1.3.0
ARG VOICE_BASE=https://huggingface.co/rhasspy/piper-voices/resolve/main/de/de_DE
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
WORKDIR /app
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
RUN pip install "piper-tts==${PIPER_VERSION}"
COPY core/pyproject.toml core/pyproject.toml
COPY core/src core/src
RUN pip install ./core
RUN mkdir -p /voices && cd /voices \
&& curl -fsSL -o de_DE-thorsten-medium.onnx "${VOICE_BASE}/thorsten/medium/de_DE-thorsten-medium.onnx" \
&& curl -fsSL -o de_DE-thorsten-medium.onnx.json "${VOICE_BASE}/thorsten/medium/de_DE-thorsten-medium.onnx.json"
ENV KNASTER_TTS_VOICES=thorsten=/voices/de_DE-thorsten-medium.onnx \
KNASTER_TTS_CMD="piper -m {model} -f {out}" \
KNASTER_TTS_PARALLEL=2
RUN useradd --system --uid 10002 tts
USER tts
EXPOSE 8090
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8090/health', timeout=4)"
CMD ["knaster", "tts-serve", "--host", "0.0.0.0", "--port", "8090"]