Builds
Details about the environment your app is built in
Shuttle builds run on AWS CodeBuild, where we compile your Rust app and place it in a Shuttle runtime
Debian-based Docker image.
Builder image
The Rust builder image is based on cargo-chef to utilize Docker-layer caching of the build dependencies.
Rust toolchain
The Rust version in the image is regularly updated to the latest stable stable-x86_64-unknown-linux-gnu
toolchain.
By default, the wasm32-unknown-unknown
target is installed, which enables compiling WASM frontends.
External tools
Apart from what is already found in the Debian-based cargo-chef image [1] [2], these apt
packages are also installed:
clang
cmake
llvm-dev
libclang-dev
mold
protobuf-compiler
Additionally, these tools are installed:
cargo-binstall
(latest)trunk
(0.19.2)
Customize build process
Feature flags
Use the βshuttleβ feature flag for custom behavior when building on Shuttle.
Environment variables
The SHUTTLE=true
env var is set in the builder image.
If you have build flags or env variables that need to be set during compilation, you can add them in .cargo/config.toml
(docs) and include it in your deployment. Below are some examples.
Runtime image
The runtime image that your built executable is placed in is a bookworm-slim
(Debian 12) with ca-certificates
and curl
installed.
(EXPERIMENTAL) Hook scripts
There are three optional bash scripts that can be used to run custom commands during the build. Create them at the root of your project.
shuttle_prebuild.sh
: Runs beforecargo build
. Can be used to install custom build dependencies.shuttle_postbuild.sh
: Runs aftercargo build
.shuttle_setup_container.sh
: Runs in the runtime image before build artifacts are copied into it. Can be used to install custom runtime dependencies.
Example: Install a custom Rust toolchain
In this example, we install and switch to the nighlty
toolchain.
Example: Install a build dependency
Example: Build a WASM frontend
Note: To use the built static assets at runtime, use build.assets.
Example: Install a runtime dependency
Was this page helpful?