FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04

ARG OMNIVOICE_VERSION=0.2.1
ARG OMNIVOICE_TRITON_VERSION=0.1.0

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
      ca-certificates curl ffmpeg libsndfile1 python3 python3-pip python3-venv \
    && rm -rf /var/lib/apt/lists/*

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:${PATH}"

RUN python -m pip install --no-cache-dir --upgrade pip \
    && python -m pip install --no-cache-dir \
      --index-url https://download.pytorch.org/whl/cu128 \
      "torch==2.8.0" "torchaudio==2.8.0" \
    && python -m pip install --no-cache-dir \
      "omnivoice==${OMNIVOICE_VERSION}" \
      "omnivoice-triton==${OMNIVOICE_TRITON_VERSION}" \
      "num2words>=0.5.14"

EXPOSE 8008

HEALTHCHECK --interval=5s --timeout=3s --start-period=600s --retries=3 \
  CMD curl -fsS http://127.0.0.1:8008/ >/dev/null || exit 1

CMD ["omnivoice-demo", "--ip", "0.0.0.0", "--port", "8008"]
