File size: 867 Bytes
47b67ad
 
 
 
fdb7b37
47b67ad
 
 
fdb7b37
47b67ad
 
 
 
fdb7b37
47b67ad
 
fdb7b37
d43bf55
47b67ad
 
fdb7b37
47b67ad
 
 
 
5d000a9
 
47b67ad
 
 
fdb7b37
5d000a9
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
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"]