model-bot / Dockerfile
MHD011's picture
Upload 4 files
fdb7b37 verified
raw
history blame contribute delete
867 Bytes
FROM python:3.9-slim
WORKDIR /app
# تثبيت الاعتمادات النظامية
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
COPY . .
# إنشاء مجلد الذاكرة المؤقتة
RUN mkdir -p /app/model_cache && chmod -R 777 /app
# تثبيت المتطلبات
RUN pip install --upgrade pip setuptools wheel
RUN pip install --no-cache-dir -r requirements.txt
# متغيرات البيئة
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV TORCH_CACHE=/app/model_cache
ENV PYTHONUNBUFFERED=1
ENV TOKENIZERS_PARALLELISM=false
EXPOSE 7860
# تشغيل التطبيق
CMD ["gunicorn", "--workers", "1", "--threads", "2", "--bind", "0.0.0.0:7860", "--timeout", "120", "--preload", "app:app"]