BYOW RUNNERS

Build a runner for the tools your project actually needs

The stock images cover the common stacks. When a project needs one more system package, a pinned toolchain or an internal certificate, extend the runner image on your own machine. The agent loop does not change. This guide works on the hosted board and on a self-hosted install.

Why project teams build one

A custom image is a small, one-time change to the machine. It removes repeated setup from every card and keeps the tools your project depends on at a known version.

Runs start warm
A system package or toolchain that used to be installed on every card is already in the image. The agent starts the build sooner and spends fewer minutes on setup.
The toolchain is reproducible
Pin a compiler, SDK or native library once. Every run gets the same version, even when the upstream image or the package mirror moves.
Private setup stays private
Internal CAs and registry hosts live in the image; tokens stay in project or workspace secrets and arrive at run time as before.

When a stock image is not enough

Build a custom image only when the missing piece cannot live in the repository. Project dependencies belong in the project; system tools and pinned runtimes belong in the image.

A native package is missing
A library such as libvips, ffmpeg or a database client is not in Debian and installing it on every job is slow or flaky.
The toolchain is pinned
A compiler, runtime or SDK version must be exact, and the stock image tracks a moving release.
Dependencies are private
Packages come from an internal registry, mirror or artifact store that needs host configuration, not an image secret.
The machine has unusual hardware
A GPU userspace, vendor runtime or a large monorepo toolchain has to be present before the first command.

Image or repository?

System packages, pinned runtimes, browser binaries, GPU userspace and internal CAs belong in the image. Lockfile installs, application dependencies and build scripts belong in the repository. If an install runs on every card and takes minutes, bake it into the project image; if it changes per commit, the lockfile already covers it.

Extend the official image

Start from ghcr.io/h4kbas/aglio-runner:latest. It already carries the agent CLIs, git, pnpm and the job contract. There is no preinstalled browser, so add Playwright/Chromium here if the project needs one. Keep /workspace and the long-lived container command.

# syntax=docker/dockerfile:1
ARG BASE_IMAGE=ghcr.io/h4kbas/aglio-runner:latest
FROM ${BASE_IMAGE}

USER root

# Pin what matters. An unpinned apt package makes yesterday's green run and
# today's run different images with the same tag.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
    --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
    apt-get update \
    && apt-get install -y --no-install-recommends \
      libvips42 \
      ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Private registries and internal CAs belong in the image only when they are
# not secrets. A token must come from the project or workspace secrets.
COPY docker/runner/certs/internal-ca.crt /usr/local/share/ca-certificates/internal-ca.crt
RUN update-ca-certificates

# Keep the agent contract: bash, git, a workspace at /workspace and a long-lived
# container. The agent starts it with `sleep infinity`.
WORKDIR /workspace
CMD ["sleep", "infinity"]

Never bake a registry token, API key or workspace secret into the image. Project and workspace secrets already reach the job at run time.

Publish and point the project at it

Any registry the worker can pull from works. Tag production images with a date or commit SHA instead of reusing latest.

docker build -f docker/runner/Dockerfile -t ghcr.io/acme/aglio-runner-web:2026-06 .
docker push ghcr.io/acme/aglio-runner-web:2026-06
  1. Open Project settings -> Workers -> Runner image and paste the image reference. The project now sends it to every worker that runs its jobs, so two projects on one machine can use different images.
    ghcr.io/acme/aglio-runner-web:2026-06
  2. Or press Create custom runner image. It opens a card that adds the Dockerfile and publish workflow, publishes an immutable tag and writes the reference back to the project setting.
  3. A private image needs docker login on the worker host so the agent can pull it through the Docker socket. No agent restart is needed for a project-level image.

One worker can still serve a single fallback image for projects without their own image. Set AGLIO_WORKER_RUNNER_IMAGE in the command or compose env for that case.

AGLIO_WORKER_RUNNER_IMAGE=ghcr.io/acme/aglio-runner-web:2026-06
Run again rebuilds the worker command and resets that fallback; projects with their own image keep it.

Keep routing in sync

The development image you pick becomes a label such as runner:node. Labels describe the machine; the image on the machine decides what actually runs.

EXTEND NODE.JS + BUN

Keep the Node.js label

A project that requires runner:node reaches this worker, and the worker starts the custom image you configured.

FULL REPLACEMENT

Use General

A custom image that replaces the whole toolchain should use the General development image and require runner:general.

Check it on the worker

Pull the image and run the tool before a card depends on it. Then start a small card on that worker and look for runner container started with the custom image in the job log.

docker pull ghcr.io/acme/aglio-runner-web:2026-06
docker run --rm ghcr.io/acme/aglio-runner-web:2026-06 bash -lc '
  pnpm --version && git --version && command -v your-tool
'

Let Aglio write the image for you

Create a card in the project, paste this prompt and let an agent add the Dockerfile, a publishing workflow and the worker notes. It opens one pull request; you review the toolchain and merge. The prompt also works when you run Aglio yourself.

You are working in an Aglio project that needs a custom BYOW runner image.

Goal: make this project build and run on a custom runner image that extends the
official Aglio runner, and leave the worker setup documented.

Do:
1. Inspect the repository and list the tools or system packages the stock
   Aglio runner is missing. Keep the list concrete and small.
2. Add docker/runner/Dockerfile. Start from
   ARG BASE_IMAGE=ghcr.io/h4kbas/aglio-runner:latest and keep the image
   contract: bash, git, WORKDIR /workspace and CMD ["sleep", "infinity"].
   Install only the missing tools and pin versions where the ecosystem allows
   it. Never put registry tokens, API keys or other secrets in the image.
3. Add .github/workflows/runner-image.yml that builds and pushes an immutable
   tag of ghcr.io/${{ github.repository_owner }}/aglio-runner-<project> on
   changes to docker/runner/**. Use the repository's existing workflow
   conventions and GitHub's built-in GITHUB_TOKEN.
4. Add a short docs/runner-image.md with the image tag pattern, the Dockerfile
   location and the worker labels this image supports.
5. Publish the image, then call project_runner_image_set with the full image
   reference so the project setting is filled.
6. Do not change application code. Open one pull request.

Acceptance:
- docker build -f docker/runner/Dockerfile . succeeds.
- The workflow builds and pushes an immutable image tag.
- project_runner_image_set saved the image on the project.
- The PR body names the custom image, the matching runner:<type> label and any
  private registry login the worker host needs.

Replace <project> and the image path when the repository already has a registry convention. The agent should not invent packages; review the list before merging.

Troubleshooting

Runner image not found and could not be pulled
Run docker pull on the worker host. A private image needs docker login for the same user that runs the agent.
The custom image is ignored
Check AGLIO_WORKER_RUNNER_IMAGE in the running agent container with docker inspect.
A project never reaches the worker
Required labels do not match. Compare the project runner:<type> requirement with the worker labels.
The job starts but a tool is missing
The tool may be in a build layer that is not in the final image. Check with docker run --rm <image> command -v <tool>.

The repo guide covers the same flow in docs/byow-custom-runner.md. See docs/byow-worker.md for enrollment and runtime options.