Files
pastor-online/backend/Dockerfile
T

39 lines
1.1 KiB
Docker

FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
OMP_NUM_THREADS=2 \
TOKENIZERS_PARALLELISM=false \
TORCH_HOME=/data/models
# 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
# PyTorch só com CPU: o wheel padrão traz ~4 GB de bibliotecas CUDA, inúteis aqui.
RUN pip install --no-cache-dir \
--index-url https://download.pytorch.org/whl/cpu \
"torch==2.5.1"
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 /data/models
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"]