Initialize the stentor-gateway project with WebSocket-based voice pipeline orchestrating STT → Agent → TTS via OpenAI-compatible APIs. - Add FastAPI app with WebSocket endpoint for audio streaming - Add pipeline orchestration (stt_client, tts_client, agent_client) - Add Pydantic Settings configuration and message models - Add audio utilities for PCM/WAV conversion and resampling - Add health check endpoints - Add Dockerfile and pyproject.toml with dependencies - Add initial test suite (pipeline, STT, TTS, WebSocket) - Add comprehensive README covering gateway and ESP32 ear design - Clean up .gitignore for Python/uv project
50 lines
1.2 KiB
Docker
50 lines
1.2 KiB
Docker
# Stentor Gateway — Multi-stage Dockerfile
|
|
# Builds a minimal production image for the voice gateway.
|
|
|
|
# --- Build stage ---
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# Install uv for fast dependency resolution
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
|
|
# Copy project files
|
|
COPY pyproject.toml .
|
|
COPY src/ src/
|
|
|
|
# Install dependencies into a virtual environment
|
|
RUN uv venv /opt/venv && \
|
|
uv pip install --python /opt/venv/bin/python . --no-cache
|
|
|
|
# --- Runtime stage ---
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
LABEL maintainer="robert"
|
|
LABEL description="Stentor Gateway — Voice gateway for AI agents"
|
|
LABEL version="0.1.0"
|
|
|
|
# Copy virtual environment from builder
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
|
|
# Copy application source (for templates/static)
|
|
COPY src/ /app/src/
|
|
|
|
WORKDIR /app
|
|
|
|
# Use the venv Python
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
ENV PYTHONPATH="/app/src"
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Default configuration
|
|
ENV STENTOR_HOST=0.0.0.0
|
|
ENV STENTOR_PORT=8600
|
|
|
|
EXPOSE 8600
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD python -c "import httpx; r = httpx.get('http://localhost:8600/api/live/'); r.raise_for_status()"
|
|
|
|
CMD ["uvicorn", "stentor.main:app", "--host", "0.0.0.0", "--port", "8600"]
|