okf-gem · blog
Engineering · Distribution

Run okf anywhere: the Docker image

RS Rodrigo Serradura · ·4 min read
🇧🇷 Ler em português

The gem was built to be light. It runs on every Ruby since 2.4, the floor an OS already ships, with two pure-Ruby dependencies and no build step. That lightness was always the point, and it still leaves one assumption: that the Ruby on the box is yours to use.

The barrier was never the tool, it was the runtime

Not every environment is a Ruby environment. A CI job for a Go or Rust project, a Kubernetes step, a data pipeline, a teammate who has never typed gem install: in each of them, adding a Ruby toolchain just to reach a Markdown validator is more friction than the validator is worth. The request that started this came from someone building on OKF who did not want to take a Ruby dependency at all, and it was the right ask. A format meant to be portable should be reachable without adopting the language it happens to be written in.

One image, the whole CLI

So okf now ships as an official image at ghcr.io/serradura/okf. It is the same CLI, entrypoint and all, with your bundle mounted at /data:

docker run --rm -v "$PWD:/data" ghcr.io/serradura/okf validate .
docker run --rm -v "$PWD:/data" ghcr.io/serradura/okf lint .
docker run --rm -v "$PWD:/data" ghcr.io/serradura/okf search . "graph server"

Whatever you would type after okf, you type after the image name. Nothing is installed on the host, and nothing is left behind. --rm throws the container away; the mount is your directory, read as ..

The graph, served from a container

The live graph works too, with one thing to know. The server binds to 127.0.0.1 by default, which is invisible from outside a container, so bind it to 0.0.0.0 and publish the port:

docker run --rm -v "$PWD:/data" -p 8808:8808 \
  ghcr.io/serradura/okf server . --bind 0.0.0.0

Open http://127.0.0.1:8808 and the graph is there. Because the server reads each body from disk on request, edits to the mounted bundle show on the next click, so this is a fine way to browse a bundle you are actively writing.

Skip the docker prefix

If the full docker run line is more than you want to type, install the command. It lands on your PATH as okf, mounts your directory, and for the server publishes the port and opens the bind on its own. Because it is named okf, the agent skill and every habit you have keep working, no Docker in sight:

curl -fsSL https://docker.okfgem.com/install.sh | sh
okf validate .
okf server .

The exact commands of the CLI, with nothing installed but a small script you can read first.

Built from source, published on every release

The image is not a convenience wrapper around gem install. It is built from the gem's own source on each release tag, so the version inside is exactly the commit it was cut from, with no window where the image and the gem disagree. It is published for linux/amd64 and linux/arm64, so it runs the same on a CI runner and on an Apple Silicon laptop. Pin :1.6.0 when you want CI to hold still, or track :latest.

Everything the gem does, it still does 100% local. The image changes how you reach okf, not what it is: no account, no telemetry, your knowledge never leaves the machine.

Pull it and point it at a repo

One command, no Ruby, your bundle at /data. The docs page has the full reference; the demo is the same tool serving a real bundle.