Download Dockerfile from MHamdan/SPARKNET: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/spaces/MHamdan/SPARKNET/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/MHamdan/SPARKNET/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MHamdan/SPARKNET/resolve/main/Dockerfile
2.63 kB
| # SPARKNET Dockerfile | |
| # Multi-stage build for optimized production image | |
| # ============== Build Stage ============== | |
| FROM python:3.11-slim as builder | |
| WORKDIR /app | |
| # Install build dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| gcc \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for caching | |
| COPY requirements.txt . | |
| COPY api/requirements.txt ./api_requirements.txt | |
| # Create virtual environment and install dependencies | |
| RUN python -m venv /opt/venv | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt && \ | |
| pip install --no-cache-dir -r api_requirements.txt | |
| # ============== Production Stage ============== | |
| FROM python:3.11-slim as production | |
| LABEL maintainer="SPARKNET Team" | |
| LABEL description="SPARKNET: Multi-Agentic Document Intelligence Platform" | |
| LABEL version="1.0.0" | |
| WORKDIR /app | |
| # Install runtime dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| # PDF processing | |
| poppler-utils \ | |
| libpoppler-cpp-dev \ | |
| # Image processing | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| # OCR support | |
| tesseract-ocr \ | |
| tesseract-ocr-eng \ | |
| # Utilities | |
| curl \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy virtual environment from builder | |
| COPY --from=builder /opt/venv /opt/venv | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Set Python environment | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONPATH=/app | |
| # Copy application code | |
| COPY src/ ./src/ | |
| COPY api/ ./api/ | |
| COPY config/ ./config/ | |
| COPY demo/ ./demo/ | |
| # Create necessary directories | |
| RUN mkdir -p /app/data/vectorstore \ | |
| /app/data/embedding_cache \ | |
| /app/uploads/documents \ | |
| /app/uploads/patents \ | |
| /app/outputs \ | |
| /app/logs | |
| # Set permissions | |
| RUN chmod -R 755 /app | |
| # Expose ports | |
| # 8000 - FastAPI | |
| # 4000 - Streamlit | |
| EXPOSE 8000 4000 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | |
| CMD curl -f http://localhost:8000/api/health || exit 1 | |
| # Default command - run FastAPI | |
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] | |
| # ============== Development Stage ============== | |
| FROM production as development | |
| # Install development dependencies | |
| RUN pip install --no-cache-dir \ | |
| pytest \ | |
| pytest-asyncio \ | |
| pytest-cov \ | |
| black \ | |
| flake8 \ | |
| mypy \ | |
| ipython \ | |
| jupyter | |
| # Development command with hot reload | |
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] | |