# Hugging Face Spaces Docker FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ curl \ git \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Create non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" ENV HOME="/home/user" WORKDIR /app # Copy requirements first for better caching COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy application files COPY --chown=user . /app # Create necessary directories RUN mkdir -p /app/instance /app/tts_cache /app/audio_cache # Set environment variables for HF Spaces ENV FLASK_ENV=production ENV IS_SPACES=true ENV PORT=7860 # Expose port EXPOSE 7860 # Run with waitress (already in requirements.txt) CMD ["python", "app.py"]