Spaces:
Sleeping
Sleeping
| # Use Python 3.10 as base | |
| FROM python:3.10-slim | |
| # 1. Install System Dependencies | |
| # libgl1-mesa-glx: Required for OpenCV | |
| # libasound2-dev & libssl-dev: Required for Azure Speech SDK | |
| # ffmpeg: Helper for audio processing | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libasound2 \ | |
| libasound2-plugins \ | |
| libssl-dev \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 2. Setup Work Directory | |
| WORKDIR /app | |
| # 3. Install Python Dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 4. Copy Server Code | |
| COPY app.py . | |
| # 5. Security: Create non-root user (Mandatory for HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 6. Expose the specific HF port | |
| EXPOSE 7860 | |
| # 7. Start Command using Gunicorn + Eventlet | |
| CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:7860", "app:app"] |