feat: rewrite tts-module in Go

Replace Python streaming TTS service with Go for smaller container images.
- VoiceRegistry: discovers custom voices from model store
- NATS subscriptions: TTS requests, voice list, voice refresh
- JetStream AI_VOICE_TTS stream setup
- Chunked audio streaming over NATS
- Dockerfile: multi-stage golang:1.25-alpine → scratch
- CI: Gitea Actions with lint/test/release/docker/notify
This commit is contained in:
2026-02-19 17:56:06 -05:00
parent 93129d945f
commit 147b685645
15 changed files with 959 additions and 1811 deletions

View File

@@ -1,14 +1,31 @@
FROM python:3.12-slim
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install ca-certificates for HTTPS
RUN apk add --no-cache ca-certificates
# Copy application code
COPY tts_streaming.py .
COPY healthcheck.py .
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Run the service
CMD ["python", "tts_streaming.py"]
# Copy source code
COPY . .
# Build static binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /tts-module .
# Runtime stage - scratch for minimal image
FROM scratch
# Copy CA certificates for HTTPS
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy binary
COPY --from=builder /tts-module /tts-module
# Run as non-root
USER 65534:65534
ENTRYPOINT ["/tts-module"]