> ## Documentation Index
> Fetch the complete documentation index at: https://docs.outerlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# The build image

> What the universal image holds, how a build picks runtime versions, and where the setup of a build belongs when the repository holds a devcontainer file.

Every build runs on the universal image, which holds the common runtimes. The
repository's [setup script](https://docs.outerlayer.ai/build-setup.md) prepares each build.

No setting turns devcontainer files on. A build applies no devcontainer file,
and no flag or config key changes that.

## A repository that holds a devcontainer file

A build leaves a devcontainer file out. This holds for a repository's own
file and for the file of its control plane. The build log has one line that
names the file that the build left out, and the repository that holds it:

```text theme={"system"}
not applied: .devcontainer/devcontainer.json of acme/app · the build runs on the universal image, and its setup belongs in .outerlayer/setup.sh
```

For a repository that a control plane governs, the line names the control
plane's file. The build never reads the governed repository's own file.

`outerlayer runner image --repository <owner/name>` builds on the universal
image and prints the same line. See
[`outerlayer runner image`](https://docs.outerlayer.ai/reference/cli-runner#outerlayer-runner-image).

A code review runs on the universal image and says nothing about the file.

### Move off a devcontainer file

Each part of a devcontainer file has a place outside the file:

| In the devcontainer file | Where it goes |
| - | - |
| `image`, or a Dockerfile's `RUN` steps that install system packages | [`.outerlayer/setup-root.sh`](https://docs.outerlayer.ai/build-setup#install-system-packages-with-a-root-setup-script), which runs as root before the build |
| A runtime version, such as a Node or Java feature | A version file in the repository. See [The runtimes in the universal image](#the-runtimes-in-the-universal-image) |
| Lifecycle commands, such as `postCreateCommand` | [`.outerlayer/setup.sh`](https://docs.outerlayer.ai/build-setup) |
| `containerEnv` | `[env]` in the repository's `mise.toml`, or [`runner.build.variables`](https://docs.outerlayer.ai/reference/config-file) for a value that fits one runner |
| `remoteUser` | Nothing. A build runs as the build user |
| The `docker-in-docker` feature | `runner.sandbox.docker` for a sandbox build. A microVM build has no way to get a Docker daemon yet |

A microVM build runs no root setup script. A microVM build has no way to
install a system package yet.

## The runtimes in the universal image

Every build runs on the universal image. The image is built on Ubuntu 24.04.
It holds Node, Python, Go, Java, Ruby and Rust, each in more than one version.
The image takes several gigabytes of the host's disk.

A build picks the version that a repository asks for. The runner reads these
version files in each checkout and installs what they name:

| Runtime | Version files |
| - | - |
| Node | `.nvmrc`, `.node-version` |
| Python | `.python-version` |
| Ruby | `.ruby-version` |
| Java | `.java-version` |
| Go | `.go-version`, and the `go` and `toolchain` lines of `go.mod` |
| Rust | `rust-toolchain.toml`, `rust-toolchain` |
| Any tool | `.tool-versions`, `mise.toml`, `.mise.toml`, `.config/mise.toml`, `.config/mise/config.toml` |

* A `mise.toml` file can name tools beyond these runtimes, and the runner
  installs them. [mise](https://mise.jdx.dev) is the version manager that the
  image uses.
* The `package.json` file does not choose the Node version.
* A runtime with no version file runs at the image's default version.

When a version is not in the image, the runner installs it before the build's
command starts. The download goes through the build's tunnel, so
`runner.build.allowHosts` applies. A refused download fails the build with
`runtime_install_failed`, and the reason names the host. The build log lists
each version and the file that chose it.

After the install, the runner runs each repository's
[setup script](https://docs.outerlayer.ai/build-setup.md).

The image also holds these tools:

* Yarn, through Corepack. Corepack downloads the version that the
  `packageManager` field of `package.json` names, the first time a build runs
  it. Yarn 1 comes from `registry.yarnpkg.com`, and a later Yarn from
  `repo.yarnpkg.com`.
* pnpm, as its own program. The first time a build runs it, pnpm downloads the
  version that `package.json` pins, from `registry.npmjs.org`. The pin is the
  `packageManager` field or the `devEngines.packageManager` field. pnpm reads
  the pin of the project it works on, so `pnpm -C web install` uses the pin in
  `web`. pnpm downloads the pinned version whatever `onFail` the
  `devEngines.packageManager` field sets. A project with no pin gets the
  image's version. A `mise.toml` file can name another version.
* uv, pipx, poetry, Maven and Gradle. A `mise.toml` file can name another
  version.
* git, Git LFS, curl, `jq`, `unzip`, a C compiler with `make`, and clang with
  libclang. A checkout holds a pointer file for each file that LFS tracks. To
  fetch the files, run `git lfs pull` in the setup script.
* The `sqlite3` and `psql` clients, ripgrep, and common command-line tools
  such as `less`, `wget`, `zip`, `rsync`, `ssh`, `lsof`, `strace` and `gdb`.
* ImageMagick (`convert`) and libvips, both with their headers, poppler's PDF
  tools (`pdftoppm` and `pdftotext`), and ffmpeg with `ffprobe`. The image has
  no Ghostscript, so ImageMagick cannot read PDF or PostScript files.
* The Docker client (`docker`), with the compose and buildx plugins. The image
  has no Docker daemon. See [Builds that need Docker](#builds-that-need-docker).
* Chromium. See [Chromium and Playwright](#chromium-and-playwright).

### Variables from mise

After the runtime install, the runner runs `mise env` in the primary checkout.
Every command of the build gets the variables that mise reports there. These
are `JAVA_HOME`, `GOROOT` and `GOBIN`, and the `[env]` values of the
repository's `mise.toml`. So a program such as a Maven wrapper script finds
`JAVA_HOME`.

Every command's `PATH` starts with the folder of each tool that mise chose. So
a program finds each tool at the version that the primary checkout pins. The
build log names each variable, with no value, and the folders.

These rules apply:

* A variable that you set wins over the value from mise: one in
  `runner.build.variables`, or one in the factory's build variables for a
  managed build.
* A variable that the runner sets itself keeps the runner's value.
* The values come from the primary checkout. A command in another checkout
  finds the same versions first. To run a tool at the version that its own
  folder pins, run it through mise, for example `mise exec -- node --version`.

### Unpinned runtimes

A repository can use a runtime and not pin its version. The runner finds the
runtimes from the repository's manifests, such as `package.json`, `go.mod` and
`Cargo.toml`. It sets `OUTERLAYER_UNPINNED_RUNTIMES` for the build's command.
The value is JSON, keyed by repository:

```json theme={"system"}
{"acme/app": ["node", "python"]}
```

The agent reads this variable. When it changes a repository that lists a
runtime, it adds that runtime's version file at the version the build used. The
next build then gets the same version.

### Chromium and Playwright

The universal image holds the Chromium that matches Playwright 1.64.1, with
the system libraries it needs. A build uses it to capture screenshots and
videos as proof. The image keeps the browser in `/ms-playwright`, and the
build user cannot write to that folder.

Before the build's commands run, the runner links each browser in
`/ms-playwright` into `$HOME/.cache/ms-playwright`. That folder is
Playwright's default, and `PLAYWRIGHT_BROWSERS_PATH` names it in the build. A
tool that drops the variable, such as turbo, finds the same folder.

A repository that uses another Playwright version installs its own browser
into that folder. Put this command in the [setup script](https://docs.outerlayer.ai/build-setup.md), which
needs no root access:

```sh theme={"system"}
npx playwright install chromium
```

The [saved state](https://docs.outerlayer.ai/build-setup.md#the-saved-state) keeps the build user's home, so
a later build does not download the browser again.

## Tools that the image lacks

The setup script and the build's command cannot install a system package.
Their root filesystem is read-only, and they run as the build user.

In a container build and a sandbox build, install a system package with a
root setup script, `.outerlayer/setup-root.sh`. The runner runs it as root
before any step of the build. See
[Install system packages with a root setup script](https://docs.outerlayer.ai/build-setup.md#install-system-packages-with-a-root-setup-script).

A microVM build runs no root setup script. There, and for a tool that needs
no root, install the tool into the build user's home, in the
[setup script](https://docs.outerlayer.ai/build-setup.md). The
[saved state](https://docs.outerlayer.ai/build-setup.md#the-saved-state) holds the home, so a later build
does not install the tool again.

* **A runtime.** Name its version in a version file. See
  [The runtimes in the universal image](#the-runtimes-in-the-universal-image).
* **A tool that a package manager installs for one user.** Use
  `cargo install`, `npm install --global`, `pipx install` or `go install`.
  Each one writes into the home.
* **Any other tool.** Download its release archive and unpack it under
  `$HOME`. Link its programs into `~/.local/bin`, which is on the `PATH` of
  every command.

> [!WARNING]
>
> A release archive can lack a part that the system package of the same tool
> installs. The script then passes, and a later command fails with an error
> that does not name the missing part.

End the setup script with the commands that the build depends on, such as one
compile and link of a small file. A missing part then fails the script, and
the reason shows that command's output.

## Builds that need Docker

A build has a Docker daemon only in these cases:

* The runner has `builtin:sandbox` hooks, and `runner.sandbox.docker` is
  `true`.
* The runner has hooks of your own that give the build one.

A container build and a microVM build have none. With no daemon, a `docker`
command fails and names the socket it could not connect to.

## Behind a proxy

On a host behind a proxy, the runner passes its `HTTP_PROXY`, `HTTPS_PROXY` and
`NO_PROXY` variables to the image build. So Docker pulls the universal image
through the proxy. No other host variable reaches the image build.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.