ocrfood / Dockerfile
ZienabM's picture
Update Dockerfile
43d677a verified
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV MODEL_PATH=RufusRubin777/GOT-OCR2_0_CPU
WORKDIR /app
# تثبيت المكتبات الأساسية
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# نسخ وتثبيت المتطلبات
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# إنشاء وتكوين مجلد الكاش
RUN mkdir -p /root/.cache/huggingface
VOLUME /root/.cache/huggingface
# تحميل النموذج مسبقاً
RUN python -c "from transformers_modules.RufusRubin777.GOT_OCR2_0_CPU.modeling_GOT import GOTModel, GOTConfig; \
from transformers import AutoTokenizer; \
model_path='RufusRubin777/GOT-OCR2_0_CPU'; \
config = GOTConfig.from_pretrained(model_path); \
model = GOTModel.from_pretrained(model_path, config=config); \
tokenizer = AutoTokenizer.from_pretrained(model_path)"
# نسخ كود التطبيق
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]