iamcodio-dia-tts / Dockerfile
iamcodio's picture
Upload Dockerfile with huggingface_hub
64036c6 verified
FROM python:3.12-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends git ffmpeg && \
rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
# Install torch with CUDA 12.8 wheels
RUN uv pip install --system \
--extra-index-url https://download.pytorch.org/whl/cu128 \
"torch>=2.8.0"
# Install dia2 deps (without dia2 itself — its setuptools config is broken,
# only lists top-level package and misses subpackages like dia2.core)
RUN uv pip install --system \
"numpy>=2.1.0,<3.0" \
"transformers>=4.55.3" \
"safetensors==0.5.3" \
"huggingface-hub>=0.24.7" \
"sphn>=0.2.0" \
"soundfile>=0.12.1" \
"whisper-timestamped>=1.14.2" \
fastapi \
uvicorn
# Clone dia2 source and add to PYTHONPATH (workaround for broken setuptools config)
RUN git clone --depth 1 https://github.com/nari-labs/dia2.git /opt/dia2
ENV PYTHONPATH="/opt/dia2:${PYTHONPATH}"
COPY app.py .
RUN useradd -m -u 1000 user
USER user
ENV HF_HOME=/tmp/hf_cache
ENV TORCH_HOME=/tmp/torch_cache
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]