# Production Dockerfile for Public Speaking Coach API # Optimized for Hugging Face Spaces or any cloud deployment FROM python:3.11-slim # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ libsndfile1 \ git \ && rm -rf /var/lib/apt/lists/* # Set working directory ENV OMP_NUM_THREADS=1 WORKDIR /app # Copy requirements first (for better caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt RUN pip install uvicorn # Copy application code COPY kid_coach_pipeline.py . COPY main.py . # Create directory for temporary files RUN mkdir -p /tmp/uploads # Expose port EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:7860/health')" # Run the application # Use port 7860 for Hugging Face Spaces compatibility CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]