# Unlike ha-gateway/ai-gateway/discord-bot, tts-gateway needs `ffmpeg` and the # `open_jtalk` CLI (+ dictionary + voice) present at runtime, which rules out # a distroless base - hence the Ubuntu runtime stage below instead. Model # artifact distribution for the inference sidecar (tts-gateway/sidecar/) is # still an open decision (TTS_GATEWAY_PLAN.md Phase 5); this image is only the # Go gateway, which has no model weights to worry about. FROM golang:1.26-bookworm AS builder WORKDIR /workspace COPY go.work go.work.sum ./ # Manifests only, copied first, so `go mod download` gets its own cache layer # invalidated only by dependency changes - not by every source edit below. COPY gen/go.mod gen/go.sum ./gen/ COPY ai-gateway/go.mod ai-gateway/go.sum ./ai-gateway/ COPY ha-gateway/go.mod ha-gateway/go.sum ./ha-gateway/ COPY discord-bot/go.mod discord-bot/go.sum ./discord-bot/ COPY alexa-bridge/go.mod alexa-bridge/go.sum ./alexa-bridge/ COPY alert-bridge/go.mod alert-bridge/go.sum ./alert-bridge/ COPY tts-gateway/go.mod tts-gateway/go.sum ./tts-gateway/ WORKDIR /workspace/tts-gateway RUN go mod download WORKDIR /workspace COPY gen/ ./gen/ COPY ai-gateway/ ./ai-gateway/ COPY ha-gateway/ ./ha-gateway/ COPY discord-bot/ ./discord-bot/ COPY alexa-bridge/ ./alexa-bridge/ COPY alert-bridge/ ./alert-bridge/ COPY tts-gateway/ ./tts-gateway/ WORKDIR /workspace/tts-gateway RUN CGO_ENABLED=0 GOOS=linux go build -o /tts-gateway ./cmd/gateway FROM ubuntu:22.04 RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ open-jtalk \ open-jtalk-mecab-naist-jdic \ hts-voice-nitech-jp-atr503-m001 \ ca-certificates \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /tts-gateway /tts-gateway EXPOSE 50053 ENTRYPOINT ["/tts-gateway"]