chronos-api-backend / Dockerfile
RemanenetSpy
feat: add XTTSv2 TTS endpoint + public demo chat with Amber voice, template-first responses, and Chronos memory consent storage
22aa01d
Raw
History Blame Contribute Delete
1.25 kB
FROM python:3.11-slim
# Set environment variables for better HF performance
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PORT=7860 \
TRANSFORMERS_CACHE=/tmp/transformers_cache \
SENTENCE_TRANSFORMERS_HOME=/tmp/sentence_transformers_cache
WORKDIR /app
# Install system dependencies (including audio libs for XTTSv2)
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
libsndfile1 \
ffmpeg \
espeak-ng \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user (Hugging Face runs as UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Install python dependencies as the user
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Cache-bust: change this value to force Docker to re-copy source files
ARG CACHE_BUST=v9
# Copy application code (fresh, no cache)
COPY --chown=user . .
# Remove any stale bytecode
RUN find /app -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; true
# Expose port 7860 for Hugging Face Spaces
EXPOSE 7860
# Start the application with debug logging
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]