Skip to content

Installation

mhupfauer edited this page May 31, 2026 · 1 revision

Installation

Three ways to get a Caddy binary with markdown_for_agents baked in.

1. Docker (recommended)

A pre-built image follows the upstream caddy release cadence and is rebuilt daily so it picks up Caddy base-image updates automatically.

docker pull ghcr.io/mhupfauer/caddy-md4agents:latest

Tags

Tag Pointer
latest Last successful build of main
vX.Y.Z A specific plugin release (e.g. v0.2.0)
caddy-<version> Built against that upstream Caddy release
sha-<short-sha> Built from that exact plugin commit

Run

Bind a Caddyfile and (optionally) your site root:

docker run --rm \
  -p 80:80 -p 443:443 -p 443:443/udp \
  -v $PWD/Caddyfile:/etc/caddy/Caddyfile:ro \
  -v $PWD/site:/srv/site:ro \
  ghcr.io/mhupfauer/caddy-md4agents:v0.2.0

For production, also mount a writable cache dir so the disk sidecar survives container restarts:

docker run -d --name caddy \
  -p 80:80 -p 443:443 -p 443:443/udp \
  -v $PWD/Caddyfile:/etc/caddy/Caddyfile:ro \
  -v $PWD/site:/srv/site:ro \
  -v caddy-data:/data \
  -v md4agents-cache:/var/cache/md4agents \
  --restart=unless-stopped \
  ghcr.io/mhupfauer/caddy-md4agents:v0.2.0

2. xcaddy (build from source)

Caddy plugins are compiled in. Use xcaddy to produce a binary that includes this module:

go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
xcaddy build --with github.com/mhupfauer/caddy-md4agents@v0.2.0

Verify the plugin registered:

./caddy list-modules | grep markdown_for_agents
# http.handlers.markdown_for_agents

Pin a specific version with @vX.Y.Z; omit for main.

3. Build the Docker image locally

git clone https://github.com/mhupfauer/caddy-md4agents
cd caddy-md4agents
docker build -t caddy-md4agents:dev .

The Dockerfile is a thin xcaddy stage on top of the official Caddy image, so a local build matches the published one byte-for-byte modulo xcaddy/Caddy version drift.

Verify it's wired up

After starting Caddy, ask any page for Markdown:

curl -sI https://example.com/ -H "Accept: text/markdown"
# expect: content-type: text/markdown; charset=utf-8
#         vary: accept
#         etag: "..."

If you get text/html, the directive isn't in the matched route — check the FAQ for ordering and path-matcher gotchas.

Clone this wiki locally