|
FROM python:3.9-slim |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
|
|
|
ENV PATH="/home/user/.local/bin:$PATH" |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
libgl1-mesa-glx \ |
|
libglib2.0-0 \ |
|
poppler-utils \ |
|
build-essential \ |
|
tesseract-ocr \ |
|
libtesseract-dev \ |
|
tesseract-ocr-jpn \ |
|
tesseract-ocr-chi-sim \ |
|
tesseract-ocr-kor \ |
|
tesseract-ocr-eng \ |
|
fonts-noto-cjk \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN tesseract --version && \ |
|
tesseract --list-langs |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY --chown=user requirements.txt . |
|
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY --chown=user . . |
|
|
|
|
|
RUN mkdir -p static/translated |
|
|
|
|
|
RUN python -c "import pytesseract; print('PyTesseract version:', pytesseract.__version__)" |
|
|
|
|
|
USER user |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |
|
|