Spaces:
Sleeping
Sleeping
File size: 943 Bytes
a13d171 88960e3 a13d171 88960e3 a13d171 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # 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"] |