CPU-only torch image (~180MB vs 873MB CUDA), PipeWire socket passthrough for audio playback, SNAC HuggingFace cache volume. Served at voice.l.supported.systems via caddy-docker-proxy.
42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
|
|
|
# PipeWire client tools — pw-play connects to the host's PipeWire socket
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
pipewire-bin \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
|
|
# Create venv
|
|
RUN uv venv
|
|
|
|
# Install CPU-only torch first (saves ~3GB vs CUDA — SNAC runs on CPU anyway)
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
# Install project dependencies (torch already satisfied, won't redownload)
|
|
COPY pyproject.toml ./
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv pip install --no-deps -r pyproject.toml 2>/dev/null || true
|
|
|
|
# Copy source and install project
|
|
COPY src/ src/
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv pip install .
|
|
|
|
# Non-root user matching host uid for PipeWire socket access
|
|
RUN useradd -u 1000 -m tts \
|
|
&& mkdir -p /home/tts/.cache/huggingface \
|
|
&& chown -R tts:tts /home/tts/.cache
|
|
USER tts
|
|
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
EXPOSE 8371
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s \
|
|
CMD python -c "import socket; s=socket.create_connection(('127.0.0.1',8371),2); s.close()" || exit 1
|
|
|
|
CMD ["tts-mcp"]
|