651b48658c
Merge origin/main into feature branch, resolving 3 conflicts: - app/api/__init__.py: add classification_rules_router alongside new routers from main (audit_logs, i18n, mobile, compliance, translation) - app/models.py: keep ClassificationRuleModel alongside new models from main (MobileDevice, ComplianceTemplate, PipelineRoutingRule) - tests/conftest.py: import both ClassificationRuleModel and new models from main (AuditLog, ComplianceTemplate) Also renumber migration from 027 to 037 to chain from the latest migration on main (036_add_document_translation_fields). Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
87 lines
2.9 KiB
Docker
87 lines
2.9 KiB
Docker
# syntax=docker/dockerfile:1
|
||
|
||
# Local development Dockerfile (avoids CI-only build metadata files)
|
||
|
||
# ── Stage 1: Python dependency builder ──────────────────────────────────────
|
||
FROM python:3.14.3-slim AS builder
|
||
|
||
WORKDIR /build
|
||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
build-essential \
|
||
libffi-dev \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# Create an isolated virtual environment
|
||
RUN python -m venv /opt/venv
|
||
|
||
ENV PATH="/opt/venv/bin:$PATH" \
|
||
PYTHONDONTWRITEBYTECODE=1 \
|
||
PIP_NO_CACHE_DIR=1
|
||
|
||
COPY requirements.txt /build/
|
||
RUN pip install --no-cache-dir -r requirements.txt \
|
||
&& find /opt/venv -type f -name "*.pyc" -delete \
|
||
&& find /opt/venv -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
||
|
||
# ── Stage 2: Documentation builder ──────────────────────────────────────────
|
||
FROM python:3.14.3-slim AS docs-builder
|
||
|
||
WORKDIR /docs
|
||
|
||
COPY docs/requirements.txt /docs/requirements.txt
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
COPY docs /docs/docs
|
||
COPY mkdocs.yml /docs/mkdocs.yml
|
||
|
||
RUN mkdocs build --config-file /docs/mkdocs.yml --site-dir /docs/docs_build
|
||
|
||
# ── Stage 3: Runtime image ───────────────────────────────────────────────────
|
||
FROM python:3.14.3-slim
|
||
|
||
WORKDIR /app
|
||
|
||
COPY --from=builder /opt/venv /opt/venv
|
||
|
||
# Install system-level OCR tools required for local OCR workflows:
|
||
# tesseract-ocr – OCR engine used by pytesseract and ocrmypdf
|
||
# ghostscript – required by ocrmypdf for PDF/PS operations
|
||
# poppler-utils – provides pdfinfo/pdftoppm used by pdf2image
|
||
# unpaper – optional deskewing pre-processor used by ocrmypdf
|
||
# wget – used by ocr_language_manager to download tessdata files
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
tesseract-ocr \
|
||
ghostscript \
|
||
poppler-utils \
|
||
unpaper \
|
||
wget \
|
||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
||
COPY ./app /app/app
|
||
COPY ./frontend /app/frontend
|
||
COPY ./migrations /app/migrations
|
||
COPY ./alembic.ini /app/alembic.ini
|
||
COPY ./LICENSE /app/LICENSE
|
||
COPY ./VERSION /app/VERSION
|
||
COPY ./BUILD_DATE /app/BUILD_DATE
|
||
|
||
# Copy the pre-built MkDocs documentation site (served at /help)
|
||
COPY --from=docs-builder /docs/docs_build /app/docs_build
|
||
|
||
# Local fallbacks for build metadata
|
||
RUN echo "local" > /app/GIT_SHA \
|
||
&& echo "local" > /app/RUNTIME_INFO
|
||
|
||
# Create necessary runtime directories in a single layer
|
||
RUN mkdir -p /app/runtime_info /workdir
|
||
|
||
ENV PATH="/opt/venv/bin:$PATH" \
|
||
PYTHONPATH=/app \
|
||
PYTHONUNBUFFERED=1 \
|
||
PYTHONDONTWRITEBYTECODE=1
|
||
|
||
EXPOSE 8000
|
||
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|