Skip to content

Build configuration ​

The build setting controls where Catapult builds a release and which artifact it publishes. Use it for Node.js servers, static sites, and Laravel executables.

Build locations ​

build.locationWhere the build runsWhat Catapult delivers
remote (default)On each server, in the new releaseSource code
localOn the workstation or CI runner running CatapultThe local build artifact
containerIn a container on the workstation or CI runner, for the server platformThe container-built artifact

Support by recipe ​

RecipeRemote (default)LocalContainer
AdonisJSServer applicationServer applicationServer application
Next.jsServer applicationStandalone server or static exportStandalone server
AstroServer applicationStatic site—
NuxtServer applicationStatic site—
Laravel GoLinux executableLinux executableLinux executable
Laravel RustLinux executableLinux executableLinux executable

Omitting build uses the recipe's default remote build. For Astro and Nuxt, the local mode requires static: true.

Remote builds ​

Let Catapult deliver the source and build on the server. Install the recipe's toolchain and package manager there. Set the location explicitly if you want to make the choice visible in the config.

typescript
set('build', { location: 'remote' })

For Laravel Go and Rust, use hosts[].bin to point to a remote go, cargo or package manager executable outside the server's PATH. Catapult uses the compiler override for both its version check and the build. For example, on a Rust host:

typescript
{
  name: 'production',
  ssh: 'deploy@example.com',
  deployPath: '/srv/myapp',
  bin: { cargo: '/home/deploy/.cargo/bin/cargo', npm: '/opt/node/bin/npm' },
}

Local builds ​

Install the build toolchain on your workstation or CI runner. For AdonisJS and Next.js, ensure any native Node.js dependencies are compatible with the server. Laravel Go can cross-compile without cgo. Laravel Rust supports native builds and cross-compilation with a target toolchain.

typescript
set('build', { location: 'local' })

Container builds ​

Install Docker or Podman on the machine running Catapult. The engine runs the builder for the server platform, then Catapult uploads the artifact. The application runs directly on the server.

typescript
set('build', { location: 'container' })

Options ​

Set these options in one build object. In a JSON deployment config, put it under store.build.

OptionApplies toDefaultDescription
locationAll supported recipesremoteSelects remote, local or container.
envAll locationsNo additional variablesPasses a map of string values to build commands.
imagecontainerRecipe builder imageOverrides the container image used for compilation.
enginecontainerAutomatic detectionSelects docker or podman on the build machine.
binaryLaravel Go and Rust, all locationsapp for Go, selected Cargo binary name for RustSets the executable file name in the release.
staticLaravel Go and Rust in all locations. Astro, Next.js and Nuxt in local.Recipe-specific linking settingsSelects a static executable or a static site export, depending on the recipe.

Build environment ​

Use build.env for build-time settings such as NODE_OPTIONS, GOFLAGS or CARGO_BUILD_JOBS. Values must be strings. For example, set NODE_OPTIONS to --max-old-space-size=1024 to cap the Node.js heap during a build. AdonisJS passes them to builds and dependency installation. Next.js passes them to builds in all modes and to dependency installation in the remote and container modes. Astro and Nuxt forward them to local static builds. Laravel recipes pass them to the Go or Rust compiler command. The separate Laravel frontend assets task uses its own process environment.

typescript
set('build', {
  location: 'remote',
  env: { CARGO_BUILD_JOBS: '1' },
})
json
{
  "store": {
    "build": {
      "location": "remote",
      "env": { "CARGO_BUILD_JOBS": "1" }
    }
  }
}

Container image and engine ​

By default, Catapult tries Docker and then Podman on the build machine. Set build.engine to choose one explicitly. Use build.image when you need a specific toolchain or an older Linux base.

RecipeDefault image
AdonisJS and Next.jsnode:<major>-bookworm, using the server's Node.js major version
Laravel Gogolang:1.27-bookworm
Laravel Rustrust:1.99-bookworm

For builds that may link dynamically, Catapult rejects a builder image whose glibc is newer than the server's. If that check fails, choose an image with a compatible Linux base through build.image. With build.static: true, Catapult verifies the executable instead of comparing glibc versions.

typescript
set('build', {
  location: 'container',
  engine: 'podman',
  image: 'node:24-bookworm',
})

Executable name ​

Set build.binary to customize the name in the release for Laravel Go or Laravel Rust. Use a file name starting with a letter or digit, followed by letters, digits, underscores or hyphens. Catapult uses that name for migrations. Match it in your systemd ExecStart or other process manager command.

typescript
set('build', { location: 'remote', binary: 'server' })

Go defaults to app. Rust defaults to the first [[bin]] in Cargo.toml, the Cargo package name if there is no explicit bin, or the target selected by laravel_rust_bin. In Rust, build.binary controls the name in the release and laravel_rust_bin selects the Cargo executable to deliver.

Static linking ​

For Laravel Go and Rust, set build.static: true with any build location to require a static Linux executable. Catapult checks the ELF architecture and rejects a binary with a dynamic loader before publication. Remote builds read the ELF headers over SSH using dd and base64.

typescript
set('build', { location: 'container', static: true })
build.staticLaravel GoLaravel Rust
trueBuilds with CGO_ENABLED=0Selects the Linux x64 or ARM64 musl target
falseBuilds with cgo enabledUses the regular native or GNU build
OmittedLocal uses laravel_go_cgo (default false). Other modes use the Go environment defaults.Local uses laravel_rust_musl (default false). Other modes use the native Cargo target.

A Go cross-build with cgo needs a C compiler for the target. Set it with build.env.CC. With build.static set, any explicit build.env.CGO_ENABLED must match the selected mode.

Rust musl setup ​

Install the Rust musl target in the toolchain that runs Cargo. For a remote build, install it on the server. For a container build, select an image via build.image that already includes the target and any required musl C toolchain. For a Linux x64 server:

bash
rustup target add x86_64-unknown-linux-musl
rustup target list --installed

Crates that compile C, such as mimalloc, also need a C compiler for musl, the musl development headers and the static musl library on the build machine. If your x64 toolchain provides musl-gcc, configure it for the target:

typescript
set('build', {
  location: 'local',
  static: true,
  env: { CC_x86_64_unknown_linux_musl: 'musl-gcc' },
})

For ARM64, use aarch64-unknown-linux-musl and configure the ARM64 compiler through CC_aarch64_unknown_linux_musl. Configure Cargo's linker separately if your toolchain requires it. A dynamic build selected with laravel_rust_musl requires a compatible musl loader and libraries on the server.

Static site exports ​

Use the main Astro, Next.js or Nuxt recipe with build.static: true and build.location: 'local'.

typescript
import '@catapultjs/deploy/recipes/nextjs'

set('build', { location: 'local', static: true })
RecipeBuild commandOutput directory
Astroastro build with static outputdist/
Next.jsnext build with output: 'export'out/
Nuxtnuxt generate.output/public/

Catapult builds the site before locking the deployment and uploads the generated directory to the root of the release. Remove the Git transfer recipe for static exports. The export uses Catapult’s artifact upload. Serve that directory with a web server. Existing astro_static, nextjs_static and nuxt_static configurations remain supported as deprecated recipes.

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 apt update
sudo apt install qemu-user-binfmt
sudo systemctl restart systemd-binfmt
bash
sudo apt update
sudo apt install qemu-user-static
sudo systemctl restart systemd-binfmt
bash
sudo dnf install qemu-user-static-aarch64
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
docker run --rm --platform linux/arm64 \
  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.