Spaces:
Running on Zero
Running on Zero
Download Dockerfile from pareshmishra/document-Intelligence-OCR: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/pareshmishra/document-Intelligence-OCR/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/pareshmishra/document-Intelligence-OCR/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/pareshmishra/document-Intelligence-OCR/resolve/main/Dockerfile
1.15 kB
| # Multi-stage / Production Dockerfile for AI Document Intelligence OCR on Google Cloud Run | |
| FROM python:3.10-slim | |
| # Prevent Python from writing .pyc files and buffer stdout/stderr | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=8080 | |
| WORKDIR /app | |
| # Install system dependencies for OpenCV, Pillow, PaddleOCR, and ONNX | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libgomp1 \ | |
| libgstreamer1.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy application source code | |
| COPY src/ ./src/ | |
| COPY app.py . | |
| COPY frontend.py . | |
| # Health check probe | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ | |
| CMD curl -f http://localhost:${PORT}/health || exit 1 | |
| # Expose container port | |
| EXPOSE 8080 | |
| # Run FastAPI with uvicorn listening on $PORT (Google Cloud Run dynamically injects PORT) | |
| CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-8080} --workers 1"] | |