Skip to content

Container builds ​

Set build.location to container to build on the machine running Catapult, such as your workstation or CI runner. Catapult builds for the server platform and uploads the resulting release. The application runs directly on the server.

This mode is available in AdonisJS, Next.js, Laravel Go and Laravel Rust.

Configure the build ​

Install Docker or Podman on the machine running Catapult.

typescript
set('build', { location: 'container' })
OptionDescription
build.engineSelect docker or podman. Catapult detects an available engine when omitted.
build.imageOverride the recipe's default build image. AdonisJS and Next.js default to node:<major>-bookworm, using the server's Node.js major version. Laravel recipes use a Go or Rust toolchain image.
build.envPass environment variables to build commands, for example NODE_OPTIONS, GOFLAGS or CARGO_BUILD_JOBS. The Node.js recipes also pass these variables to dependency installation.

Choose an image with the toolchain your application needs. Catapult rejects an image whose glibc is newer than the server's. If that check fails, choose an image with an older Linux base through build.image.

Custom tasks in the build container ​

Use await container(command), imported from @catapultjs/deploy, in a TypeScript task. In JSON, register a task with a container step. This Next.js example packages the standalone output after the build and before upload.

typescript
import { after, container, task } from '@catapultjs/deploy'

task('app:package', async () => {
  await container('node deploy/package-standalone.mjs')
})

after('deploy:build', 'app:package')
json
{
  "tasks": {
    "app:package": [{ "container": { "command": "node deploy/package-standalone.mjs" } }]
  },
  "after": { "deploy:build": "app:package" }
}

The following hooks run while the build container is active.

RecipesBefore compilationAfter compilation, before upload
AdonisJS and Next.jsbefore('deploy:build', …)after('deploy:build', …)
Laravel Go and Laravel Rustbefore('native:build', …)after('native:build', …)

Commands start in the configured application directory for AdonisJS and Next.js and at the project root for Laravel. Set cwd to use another directory inside the container.

Each host has its own build session. Catapult removes the container at the end of the deployment, including when a task fails. Cache volumes can persist between runs.

Building for another CPU architecture ​

build.location: 'container' passes the server platform to Docker or Podman. For example, --platform linux/arm64 selects an ARM64 image. On an x86_64 Linux build machine, running that image requires ARM64 emulation, typically QEMU registered with binfmt_misc on the host running the container engine. If the image pulls successfully and the container exits with Exec format error at startup, check that the emulator is registered on that host.

On the Linux host running Docker or Podman, install the QEMU package for your distribution and reload the registrations.

bash
sudo dnf install qemu-user-static-aarch64
sudo systemctl restart systemd-binfmt
bash
sudo apt update
sudo apt install qemu-user-static
sudo systemctl restart systemd-binfmt
bash
sudo apt update
sudo apt install qemu-user-binfmt
sudo systemctl restart systemd-binfmt

On Ubuntu, these packages are in the Universe repository. See the package listings for Fedora, Debian 12, Debian 13 and Ubuntu.

Before deploying, run the following from the build machine. Use the same engine, image and platform as your deployment. This example should print arm64.

bash
podman run --rm --platform linux/arm64 \
  docker.io/library/node:24-bookworm node -p process.arch

With Podman on Linux, Catapult mounts the project with the shared SELinux label option (:z). Podman can recursively relabel files in the project directory so that builds can read the source and write to .catapult/ with SELinux enforcing.