From 99e741f2de2881c2b2253ab1c0f75b1d75c12975 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Thu, 18 Jun 2026 21:57:20 -0500 Subject: [PATCH] docker implementation --- .dockerignore | 10 ++++++++++ Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ docs/index.md | 22 ++++++++++++++++++++++ docs/mcp_layout.md | 3 +++ 4 files changed, 79 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ea3ba73 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git +.github +.venv +__pycache__ +.cache* +.mypy_cache +.pytest_cache +.ruff_cache +site/ +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a361472 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +# syntax=docker/dockerfile:1 + +FROM python:3.12-slim AS builder + +COPY --from=ghcr.io/astral-sh/uv:0.8.4 /uv /uvx /bin/ + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + UV_COMPILE_BYTECODE=1 \ + UV_LINK_MODE=copy + +WORKDIR /app + +COPY pyproject.toml uv.lock ./ +COPY src ./src + +RUN uv sync --frozen --no-dev + +COPY docs ./docs +COPY skills ./skills +COPY zensical.toml ./ + +RUN uv run zensical build + +FROM python:3.12-slim AS runtime + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PATH="/app/.venv/bin:$PATH" \ + PERSONAL_MCP_HOST=0.0.0.0 \ + PERSONAL_MCP_PORT=8765 + +WORKDIR /app + +RUN groupadd --system --gid 1001 appuser \ + && useradd --system --uid 1001 --gid appuser --create-home --home-dir /home/appuser appuser + +COPY --from=builder --chown=appuser:appuser /app /app + +EXPOSE 8765 + +USER appuser + +CMD ["uvicorn", "personal_mcp.main:app", "--host", "0.0.0.0", "--port", "8765"] \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 7d75c90..3c6475c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,6 +4,28 @@ icon: lucide/rocket # Get started +## Quick start + +Install dependencies first: + +```bash +uv sync +``` + +Run the app locally with the static docs rebuilt first: + +```bash +uv run zensical build && uv run uvicorn personal_mcp.main:app --host 127.0.0.1 --port 8765 +``` + +Build and run the Docker image with the same exposed port: + +```bash +docker build -t personal-mcp . && docker run --rm -p 8765:8765 personal-mcp +``` + +When the server is running, the health check is available at `/healthz` and the generated docs are available at `/docs/`. + ## Architecture - [Resource-First Pattern Module Architecture](./architecture.md) diff --git a/docs/mcp_layout.md b/docs/mcp_layout.md index 527bd5e..29ae57e 100644 --- a/docs/mcp_layout.md +++ b/docs/mcp_layout.md @@ -13,6 +13,9 @@ It also treats Markdown as the single source of truth for both MCP resources and ```mermaid --- config: + treeView: + rowIndent: 40 + lineThickness: 2 themeVariables: treeView: labelColor: '#FFFFFF'