feat(backend): add PDF extraction with OCR fallback and cache
This commit is contained in:
1 parent
1b860dc599
commit
b75b746a40
8 files changed
+647
No files matched your search
@@ -0,0 +1,32 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
OMP_NUM_THREADS=2 \
|
||||
TOKENIZERS_PARALLELISM=false
|
||||
|
||||
# tesseract-ocr + pacote de idioma português + libs de imagem do MuPDF
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
tesseract-ocr \
|
||||
tesseract-ocr-por \
|
||||
tesseract-ocr-eng \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt requirements-dev.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements-dev.txt
|
||||
|
||||
COPY app ./app
|
||||
COPY tests ./tests
|
||||
|
||||
RUN mkdir -p /data/vector_db /data/pdfs
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||
CMD curl -fsS http://localhost:8000/api/health || exit 1
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
Reference in new issue
Block a user