# Forced-aligner sidecar: word-level timing with torchaudio MMS_FA. Not part of the app image. # CPU (default): docker compose up -d --build tts-aligner # GPU (optional): docker compose --profile gpu up -d --build tts-aligner-gpu FROM python:3.12-slim-bookworm ARG TORCH_INDEX=https://download.pytorch.org/whl/cpu ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 TORCH_HOME=/models/torch HF_HOME=/models/hf RUN apt-get update && apt-get install -y --no-install-recommends libsndfile1 curl \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /tmp/requirements.txt RUN pip install --index-url "$TORCH_INDEX" torch==2.10.0 torchaudio==2.10.0 \ && pip install -r /tmp/requirements.txt RUN useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin aligner && mkdir -p /models && chown aligner /models WORKDIR /srv COPY app.py . USER aligner EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \ CMD curl -fsS http://127.0.0.1:8000/health || exit 1 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--no-access-log"]