| | |
| | FROM python:3.11-slim |
| |
|
| | WORKDIR /app |
| |
|
| | |
| | RUN apt-get update && apt-get install -y \ |
| | curl \ |
| | tesseract-ocr \ |
| | tesseract-ocr-eng \ |
| | tesseract-ocr-deu \ |
| | tesseract-ocr-fra \ |
| | tesseract-ocr-spa \ |
| | tesseract-ocr-por \ |
| | tesseract-ocr-ita \ |
| | tesseract-ocr-rus \ |
| | tesseract-ocr-chi-sim \ |
| | tesseract-ocr-jpn \ |
| | tesseract-ocr-kor \ |
| | poppler-utils \ |
| | libgl1 \ |
| | libglib2.0-0 \ |
| | && rm -rf /var/lib/apt/lists/* |
| |
|
| | |
| | ENV PYTHONUNBUFFERED=1 |
| | ENV PYTHONIOENCODING=UTF-8 |
| | ENV HF_HOME=/tmp/cache |
| | ENV PORT=7860 |
| |
|
| | COPY requirements.txt . |
| | RUN pip install --upgrade pip setuptools wheel \ |
| | && pip install --default-timeout=100 --retries=10 --no-cache-dir -r requirements.txt |
| |
|
| | COPY . . |
| |
|
| | RUN useradd -m appuser && chown -R appuser /app |
| | USER appuser |
| |
|
| | RUN mkdir -p ${HF_HOME} && chmod 777 ${HF_HOME} |
| |
|
| | EXPOSE $PORT |
| |
|
| | CMD bash -c "\ |
| | (while true; do curl -s https://xce009-ocr-api.hf.space >/dev/null; sleep 300; done) & \ |
| | uvicorn main:app --host 0.0.0.0 --port ${PORT} --workers 4" |