Proofly / Dockerfile
dipan004's picture
Update Dockerfile
1e57df1 verified
# STRATEGY: Start fast WITHOUT Tesseract, install on first OCR request
# Startup: ~2 minutes | First OCR request: +30 seconds (one-time)
FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1 \
PORT=7860 \
OCR_ENABLED=true \
AI_ENABLED=false
WORKDIR /app
# Install only Python packages (fast)
COPY requirements.txt .
RUN pip install --no-cache-dir \
fastapi==0.104.1 \
uvicorn[standard]==0.24.0 \
python-multipart==0.0.6 \
python-dotenv==1.0.0 \
Pillow==10.1.0 \
pytesseract==0.3.10
# Copy app files
COPY app.py .
COPY core/ ./core/
COPY agents/ ./agents/
COPY models/ ./models/
COPY config/ ./config/
COPY sidecar/ ./sidecar/
# Create install script for Tesseract (runs on first OCR request)
RUN echo '#!/bin/bash\n\
if ! command -v tesseract &> /dev/null; then\n\
echo "Installing Tesseract..."\n\
apt-get update && apt-get install -y --no-install-recommends tesseract-ocr tesseract-ocr-eng\n\
rm -rf /var/lib/apt/lists/*\n\
fi' > /app/install_tesseract.sh && chmod +x /app/install_tesseract.sh
# Note: Tesseract NOT installed yet - will be installed on first OCR use
# This makes initial startup much faster
EXPOSE 7860
# No health check for fastest startup
HEALTHCHECK NONE
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]