Rust
Railpack builds and deploys Rust applications.
Detection
Section titled “Detection”Your project will be detected as a Rust application if any of these conditions are met:
- A
Cargo.tomlfile is present
Versions
Section titled “Versions”The Rust version is determined in the following order:
- Any mise-supported version file (
mise.toml,.tool-versions, etc). - Read from the
toolchain.channelfield in therust-toolchain.tomlfile - Read from the
package.rust-versionfield in theCargo.tomlfile - Read from the
.rust-versionorrust-version.txtfile - Set via the
RAILPACK_RUST_VERSIONenvironment variable - Set via the
package.editionfield in theCargo.tomlfile - Defaults to
1.89
Runtime Variables
Section titled “Runtime Variables”These variables are available at runtime:
ROCKET_ADDRESS="0.0.0.0"Configuration
Section titled “Configuration”Railpack builds your Rust application based on your project structure. The build process:
- Installs Rust and required system dependencies
- Installs package dependencies
- Compiles the application to a binary
The start command is:
./bin/<project-name>Config Variables
Section titled “Config Variables”| Variable | Description | Example |
|---|---|---|
RAILPACK_RUST_VERSION | Override the Rust version | 1.85.1 |
BuildKit Caching
Section titled “BuildKit Caching”The Rust provider will cache ~/.cargo/registry under the key cargo_registry, ~/.cargo/git under cargo_git, and target under cargo_target.