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.location | Where the build runs | What Catapult delivers |
|---|---|---|
remote (default) | On each server, in the new release | Source code |
local | On the workstation or CI runner running Catapult | The local build artifact |
container | In a container on the workstation or CI runner, for the server platform | The container-built artifact |
Support by recipe
| Recipe | Remote (default) | Local | Container |
|---|---|---|---|
| AdonisJS | Server application | Server application | Server application |
| Next.js | Server application | Standalone server or static export | Standalone server |
| Astro | Server application | Static site | — |
| Nuxt | Server application | Static site | — |
| Laravel Go | Linux executable | Linux executable | Linux executable |
| Laravel Rust | Linux executable | Linux executable | Linux 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.
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:
{
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.
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.
set('build', { location: 'container' })Options
Set these options in one build object. In a JSON deployment config, put it under store.build.
| Option | Applies to | Default | Description |
|---|---|---|---|
location | All supported recipes | remote | Selects remote, local or container. |
env | All locations | No additional variables | Passes a map of string values to build commands. |
image | container | Recipe builder image | Overrides the container image used for compilation. |
engine | container | Automatic detection | Selects docker or podman on the build machine. |
binary | Laravel Go and Rust, all locations | app for Go, selected Cargo binary name for Rust | Sets the executable file name in the release. |
static | Laravel Go and Rust in all locations. Astro, Next.js and Nuxt in local. | Recipe-specific linking settings | Selects 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.
set('build', {
location: 'remote',
env: { CARGO_BUILD_JOBS: '1' },
}){
"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.
| Recipe | Default image |
|---|---|
| AdonisJS and Next.js | node:<major>-bookworm, using the server's Node.js major version |
| Laravel Go | golang:1.27-bookworm |
| Laravel Rust | rust: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.
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.
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.
set('build', { location: 'container', static: true })build.static | Laravel Go | Laravel Rust |
|---|---|---|
true | Builds with CGO_ENABLED=0 | Selects the Linux x64 or ARM64 musl target |
false | Builds with cgo enabled | Uses the regular native or GNU build |
| Omitted | Local 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:
rustup target add x86_64-unknown-linux-musl
rustup target list --installedCrates 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:
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'.
import '@catapultjs/deploy/recipes/nextjs'
set('build', { location: 'local', static: true })| Recipe | Build command | Output directory |
|---|---|---|
| Astro | astro build with static output | dist/ |
| Next.js | next build with output: 'export' | out/ |
| Nuxt | nuxt 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.
import { after, container, task } from '@catapultjs/deploy'
task('app:package', async () => {
await container('node deploy/package-standalone.mjs')
})
after('deploy:build', 'app:package'){
"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.
| Recipes | Before compilation | After compilation, before upload |
|---|---|---|
| AdonisJS and Next.js | before('deploy:build', …) | after('deploy:build', …) |
| Laravel Go and Laravel Rust | before('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.
sudo apt update
sudo apt install qemu-user-binfmt
sudo systemctl restart systemd-binfmtsudo apt update
sudo apt install qemu-user-static
sudo systemctl restart systemd-binfmtsudo dnf install qemu-user-static-aarch64
sudo systemctl restart systemd-binfmtOn 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.
docker run --rm --platform linux/arm64 \
node:24-bookworm node -p process.archWith 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.