duol-agent / Dockerfile
Mapmaven's picture
Upload Dockerfile with huggingface_hub
40cc88e verified
Raw History Blame Contribute Delete
1.3 kB
FROM python:3.11-slim
WORKDIR /app
# System dependencies for building native extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ libgomp1 ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Install PyTorch (CPU-only) first — smaller image, faster build
RUN pip install --no-cache-dir \
torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install all other dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source files
COPY agent.py .
COPY tts_mms.py .
COPY tts_api.py .
COPY tts_edge.py .
COPY entrypoint.py .
# Pre-download core MMS-TTS models into the image layer
RUN python -c "\
from transformers import VitsModel, AutoTokenizer; \
codes = ['swh', 'kik']; \
[( \
print(f'Downloading facebook/mms-tts-{code}...'), \
VitsModel.from_pretrained(f'facebook/mms-tts-{code}'), \
AutoTokenizer.from_pretrained(f'facebook/mms-tts-{code}'), \
print(f' ✅ {code} cached.') \
) for code in codes]; \
print('Core models cached.')"
# HF Spaces runs as a non-root user
RUN useradd -m appuser && chown -R appuser /app
USER appuser
# Port 7860 is required by HF Spaces
EXPOSE 7860
# 'start' tells the LiveKit CLI to run in production worker mode
CMD ["python", "entrypoint.py", "start"]