mohannad125's picture
Update Dockerfile
cad80fa verified
FROM python:3.11-slim
# تثبيت تبعيات النظام
RUN apt-get update && apt-get install -y ffmpeg libsndfile1 curl && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ترقية pip و setuptools و wheel
RUN pip install --upgrade pip setuptools wheel
# نسخ وتثبيت تبعيات Python
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# نسخ ملفات التطبيق
COPY app.py model_loader.py index.html gunicorn.conf.py cnn_lstm_emotion_model.pth ./
# إنشاء مجلد للملفات المرفوعة
RUN mkdir -p uploads
# Healthcheck اختياري
HEALTHCHECK --start-period=120s --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost:7860/health || exit 1
# تعيين المنفذ الافتراضي لمنصة Hugging Face Spaces
ENV PORT=7860
EXPOSE 7860
# تشغيل التطبيق باستخدام Gunicorn مع UvicornWorker
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "app:app"]