46b2f17acc
- Add MkDocs Material docs build stage to Dockerfile and Dockerfile.local - Mount pre-built docs as static files at /help/ in FastAPI (app/main.py) - Add app/views/help.py with /help → /help/ permanent redirect route - Register help router in app/views/__init__.py - Add Help nav link to base.html (public + app nav, desktop + mobile) - Create how-to guides: HP printer, ScanSnap, watched folder, email ingestion, mobile scanning - Update mkdocs.yml with How-To Guides section and Material theme palette - Add optional docs service (squidfunk/mkdocs-material) to docker-compose.yaml with docs profile - Add mkdocs-material to requirements-dev.txt - Add /docs_build to .gitignore - Add tests for help view (8 tests, 100% coverage on help.py) Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
80 lines
2.6 KiB
Docker
80 lines
2.6 KiB
Docker
# Use multi-stage build for a smaller final image
|
||
FROM python:3.14.1 AS builder
|
||
|
||
WORKDIR /app
|
||
|
||
# Copy requirements first for better layer caching
|
||
COPY requirements.txt /app/
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# ── Documentation build stage ───────────────────────────────────────────────
|
||
FROM python:3.14.1-slim AS docs-builder
|
||
|
||
WORKDIR /docs
|
||
|
||
# Install MkDocs Material and its dependencies
|
||
COPY docs/requirements.txt /docs/requirements.txt
|
||
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
||
# Copy documentation sources
|
||
COPY docs /docs/docs
|
||
COPY mkdocs.yml /docs/mkdocs.yml
|
||
|
||
# Build the static documentation site
|
||
RUN mkdocs build --config-file /docs/mkdocs.yml --site-dir /docs/docs_build
|
||
|
||
# Second stage for the actual runtime
|
||
FROM python:3.14.3-slim
|
||
|
||
WORKDIR /app
|
||
|
||
# Copy installed packages from builder stage
|
||
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
|
||
COPY --from=builder /usr/local/bin /usr/local/bin
|
||
|
||
# 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 application code
|
||
COPY ./app /app/app
|
||
COPY ./frontend /app/frontend
|
||
COPY ./migrations /app/migrations
|
||
COPY ./alembic.ini /app/alembic.ini
|
||
COPY ./LICENSE /app/LICENSE
|
||
|
||
# Copy build metadata files (generated at build time)
|
||
COPY ./VERSION /app/VERSION
|
||
COPY ./BUILD_DATE /app/BUILD_DATE
|
||
COPY ./GIT_SHA /app/GIT_SHA
|
||
COPY ./RUNTIME_INFO /app/RUNTIME_INFO
|
||
|
||
# Copy the pre-built MkDocs documentation site (served at /help)
|
||
COPY --from=docs-builder /docs/docs_build /app/docs_build
|
||
|
||
# Create runtime_info directory
|
||
RUN mkdir -p /app/runtime_info
|
||
|
||
# Create necessary directories
|
||
RUN mkdir -p /workdir
|
||
|
||
# Set environment variables
|
||
ENV PYTHONPATH=/app
|
||
ENV PYTHONUNBUFFERED=1
|
||
|
||
# Expose the port the app runs on
|
||
EXPOSE 8000
|
||
|
||
# Default command
|
||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|