Skip to content

Add docker deployment #43

Description

@mattanapol

Context

The project is a Python 3.11+ CLI tool (olw) with no existing Docker support. Docker makes it easier to run the pipeline without a local Python install. The container only wraps the olw tool — the user provides their own LLM backend (local Ollama, LM Studio, or cloud provider). The main challenges are: configuring git identity so auto-commits don't fail.


Propose changes

  1. .dockerignore

Exclude tests/, docs/, scripts/, .git, pycache, *.pyc, uv.lock, .ruff_cache, .claude/, Dockerfile, docker-compose.yml, editor artifacts.

Note on uv.lock: excluded by default (builds resolve latest compatible versions). Include for fully-reproducible production builds.

  1. Dockerfile

Multi-stage build — no config generation, no entrypoint script:

  • Stage 1 (builder): python:3.11-slim + install uv + uv pip install --system --prefix /opt/olw .
  • Stage 2 (runtime): python:3.11-slim + apt-get install git + copy /opt/olw from builder + set PATH=/opt/olw/bin:$PATH and
    PYTHONPATH=/opt/olw/lib/python3.11/site-packages
  • One-time git config --global safe.directory '*' baked into the image (handles ownership mismatch when vault bind-mount is owned by host user; safe inside a container)
  • ENTRYPOINT ["olw"], CMD ["--help"]
  • No entrypoint script — the image only ships the program
  1. docker-compose.yml

Single service — just olw:

  • Built from ., stdin_open: true, tty: true (for review command)
  • Three bind mounts — all content from host:
    a. ${HOST_VAULT_PATH}:/vault — vault (raw notes, wiki, state DB)
    b. ${OLW_CONFIG_PATH:-~/.config/olw}:/root/.config/olw — global config (config.toml)
    c. ~/.gitconfig:/root/.gitconfig:ro — git identity for auto-commits (read-only)
  • Env: OLW_VAULT=/vault (tells olw where the vault is inside the container)
  • Cloud provider keys passed via env vars if needed: GROQ_API_KEY, OLW_API_KEY, etc.

The user's ~/.config/olw/config.toml on the host controls provider URL, model names, and API key — no Docker-specific config needed. For local Ollama on Mac/Windows the URL should be http://host.docker.internal:11434 in that config file.


Verification

Build image

docker build -t olw:local .

Basic smoke (no vault needed)

docker run --rm olw:local --help

Full integration test (requires Ollama running locally or in compose)

HOST_VAULT_PATH=/path/to/test-vault docker compose run olw doctor
HOST_VAULT_PATH=/path/to/test-vault docker compose run olw ingest --all

Caveats

  • Ollama on host (Mac/Windows): in ~/.config/olw/config.toml set provider_url = "http://host.docker.internal:11434". On Linux, host.docker.internal doesn't resolve — use extra_hosts: ["host.docker.internal:host-gateway"] in docker-compose.yml or --network host.
  • olw setup writes to ~/.config/olw/config.toml which is the mounted host file — changes persist correctly.
  • watch command: inotify works on Linux Docker. Mac Docker Desktop VirtioFS (4.6+) passes events through; older osxfs may not.
  • review command: interactive; use docker compose run -it olw review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions