receipt-ocr / Dockerfile
Khaw100
Force reinstall numpy 1.x at the very end
5cb6fe6
FROM python:3.10-slim
WORKDIR /app
# 1. Install dependensi OS
RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libgomp1 \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
ENV PADDLE_DISABLE_ONEDNN=1
COPY requirements.txt .
# 2. Install semua library (Termasuk imgaug dan paddleocr)
# Biarkan pip menarik versi apapun yang mereka mau di tahap ini
RUN pip install --no-cache-dir -r requirements.txt || true
RUN pip install --no-cache-dir \
imgaug \
"paddlepaddle==2.6.2" \
"paddleocr==2.7.3" \
fastapi \
uvicorn \
Pillow \
"torch==2.0.1" \
"transformers==4.40.0" \
sentencepiece \
openai \
python-multipart
# 3. PEMBERSIHAN OpenCV GUI yang bertabrakan
RUN pip uninstall -y opencv-python opencv-contrib-python || true
# 4. JURUS PAMUNGKAS: Paksa timpa NumPy ke versi 1.x dan OpenCV ke Headless
# Menggunakan --force-reinstall memastikan tidak ada library lain yang bisa membantah
RUN pip install --no-cache-dir --force-reinstall "numpy==1.26.4" "opencv-python-headless==4.8.0.76"
COPY . .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]