Vidulividuli

Rust

Comprehensive information about Rust app configuration.

Common Settings

The section outlines common settings and behaviours for Rust projects.

Rust Version

The Rust version is automatically detected from Cargo.toml file in the root directory of your project and the appropriate image is selected according to it.

The version is extracted from the rust-version field in the [package] section. Example,

[package]
rust-version = "1.92.0"

If the package secton is missing, the build system will search fo a root-level rust-version field or fallback to the default.

Ensure you use a version supported by the docker rust image.

Build Process

Rust builds on Viduli use a single build and run image. Cargo is used to compile your application in release mode.

Rust support may move to a more optimized runtime image in the future.

Actix Web

  • Base distribution: Debian 12 Bookworm Slim
  • Default Rust version: 1.92.0
  • Default image: rust:1.92.0-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are installed with the cargo build --release command and cached for faster builds.

You can customize the install process by setting the install command in the resource build confguration.

Build command

By default, the build command is cargo build --release. You can customize it by setting the build command in the resource build configuration.

Run command

The run command is automatically detected from your Cargo.toml:

  • If [[bin]] sections exist, the first binary is used
  • Otherwise, the package name from [package] is used and executed as ./target/release/<package-name>

You can override this by providing the run command in the resource build configuration.

Environment

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Axum

Rust builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Rust version: 1.92.0
  • Default image: rust:1.92.0-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 3000

Build dependencies

Dependencies are built using Cargo. The build process uses a two-step approach to optimize Docker layer caching:

  1. First, dependencies are built with a dummy main.rs
  2. Then, your actual source code is copied and the full build runs

Build command

By default, the build command is cargo build --release. You can customize it by setting the build command value in the resource build configuration.

Run command

The run command is automatically detected from your Cargo.toml:

  • If [[bin]] sections exist, the first binary is used
  • Otherwise, the package name from [package] is used and executed as ./target/release/<package-name>

You can override this by providing the run command in the resource build configuration.

Environment

By default, PORT is set to 3000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Rocket

Rocket builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Rust version: 1.92.0
  • Default image: rust:1.92.0-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8000

Build dependencies

Dependencies are built using Cargo. The build process uses a two-step approach to optimize Docker layer caching:

  1. First, dependencies are built with a dummy main.rs
  2. Then, your actual source code is copied and the full build runs

Build command

By default, the build command is cargo build --release. You can customize it by setting the build command value in the resource build configuration.

Run command

The run command is automatically detected from your Cargo.toml:

  • If [[bin]] sections exist, the first binary is used
  • Otherwise, the package name from [package] is used and executed as ./target/release/<package-name>

You can override this by providing the run command in the resource build configuration.

Environment

By default, PORT is set to 8000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Loco

Loco builds on Viduli use a single build and run image.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Rust version: 1.92.0
  • Default image: rust:1.92.0-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 3000

Build dependencies

Dependencies are built using Cargo. The build process uses a two-step approach to optimize Docker layer caching:

  1. First, dependencies are built with a dummy main.rs
  2. Then, your actual source code is copied and the full build runs

Build command

By default, the build command is cargo build --release. You can customize it by setting the build command value in the resource build configuration.

Run command

The run command is automatically detected from your Cargo.toml:

  • If [[bin]] sections exist, the first binary is used
  • Otherwise, the package name from [package] is used and executed as ./target/release/<package-name>

You can override this by providing the run command in the resource build configuration.

Environment

By default, PORT is set to 3000. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.

Cargo (Generic)

The generic Cargo build option is suitable for deploying any Rust project built with Cargo, regardless of framework.

  • Base distribution: Debian 12 Bookworm Slim
  • Default Rust version: 1.92.0
  • Default image: rust:1.92.0-slim-bookworm
  • Included packages: build-essential ca-certificates procps git curl wget nano
  • Default port: 8080

Build dependencies

Dependencies are built using Cargo. The build process uses a two-step approach to optimize Docker layer caching:

  1. First, dependencies are built with a dummy main.rs
  2. Then, your actual source code is copied and the full build runs

Build command

By default, the build command is cargo build --release. You can customize it by setting the build command value in the resource build configuration.

Run command

The run command is automatically detected from your Cargo.toml:

  • If [[bin]] sections exist, the first binary is used (with a warning if multiple bins exist)
  • Otherwise, the package name from [package] is used and executed as ./target/release/<package-name>

You can override this by providing the run command in the resource build configuration.

Environment

By default, PORT is set to 8080. If you set an expose port value in the resource build configuration, PORT is set to that value.

Secrets added to the resource are also available in the environment during the image build and run stages.