FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libgomp1 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* # Copy requirements COPY requirements.txt . # Install python dependencies # Using a mirror or specific install command for paddle might be safer, # but pip install -r usually works for cpu versions. RUN pip install --no-cache-dir -r requirements.txt # Download the model files by running a dummy OCR once or explicitly downloading # PaddleOCR downloads models to ~/.paddleocr by default # We can pre-trigger this. RUN python -c "from paddleocr import PaddleOCR; PaddleOCR(use_angle_cls=True, lang='en', use_gpu=False)" # Copy source code COPY ocr_server.py . # Expose port EXPOSE 5001 # Command to run CMD ["python", "ocr_server.py"]