| |
| |
|
|
| |
| FROM python:3.11-slim as builder |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| gcc \ |
| g++ \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt . |
| COPY api/requirements.txt ./api_requirements.txt |
|
|
| |
| 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 |
|
|
| |
| 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 |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| |
| poppler-utils \ |
| libpoppler-cpp-dev \ |
| |
| libgl1-mesa-glx \ |
| libglib2.0-0 \ |
| libsm6 \ |
| libxext6 \ |
| libxrender-dev \ |
| |
| tesseract-ocr \ |
| tesseract-ocr-eng \ |
| |
| curl \ |
| wget \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY --from=builder /opt/venv /opt/venv |
| ENV PATH="/opt/venv/bin:$PATH" |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| PYTHONPATH=/app |
|
|
| |
| COPY src/ ./src/ |
| COPY api/ ./api/ |
| COPY config/ ./config/ |
| COPY demo/ ./demo/ |
|
|
| |
| RUN mkdir -p /app/data/vectorstore \ |
| /app/data/embedding_cache \ |
| /app/uploads/documents \ |
| /app/uploads/patents \ |
| /app/outputs \ |
| /app/logs |
|
|
| |
| RUN chmod -R 755 /app |
|
|
| |
| |
| |
| EXPOSE 8000 4000 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ |
| CMD curl -f http://localhost:8000/api/health || exit 1 |
|
|
| |
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] |
|
|
| |
| FROM production as development |
|
|
| |
| RUN pip install --no-cache-dir \ |
| pytest \ |
| pytest-asyncio \ |
| pytest-cov \ |
| black \ |
| flake8 \ |
| mypy \ |
| ipython \ |
| jupyter |
|
|
| |
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] |
|
|