ocr-engine-3 / Dockerfile
kanha-upadhyay's picture
init
e42e330
raw
history blame
922 Bytes
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies including those needed for OCR and ML models
RUN apt-get update && apt-get install -y \
curl \
poppler-utils \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Install poetry
RUN pip install poetry
# Configure poetry
RUN poetry config virtualenvs.create false
# Copy dependency files
COPY pyproject.toml poetry.lock* /app/
# Install dependencies
RUN poetry install --only main --no-root
# Download spacy model
RUN python -m spacy download en_core_web_sm
# Create user
RUN useradd -m -u 1000 appuser
# Copy source code
COPY --chown=appuser src /app/src
COPY --chown=appuser main.py /app/
# Change ownership
RUN chown -R appuser /app
USER appuser
EXPOSE 8001
ENV PYTHONUNBUFFERED=1
ENV SPACY_MODEL_NAME=en_core_web_sm
CMD ["python", "main.py"]