FROM mcr.microsoft.com/playwright/python:v1.51.0-jammy WORKDIR /app # Install system dependencies for Audio (PortAudio, FFmpeg) # The base image already has browser dependencies RUN apt-get update && apt-get install -y \ portaudio19-dev \ ffmpeg \ libsndfile1 \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN pip install uvicorn gunicorn # Copy application code COPY src/ ./src/ COPY config/ ./config/ # Environment variables ENV PYTHONPATH=/app ENV PYTHONUNBUFFERED=1 # Health check (HF Spaces runs on port 7860) HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 EXPOSE 7860 # Hugging Face Spaces expects the app to be on port 7860 CMD ["gunicorn", "src.api.websocket_server:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860"]