Run a Rust Application
Checkout and Build the Application
A Hello World example Rust application is provided in our GitHub repository. Clone the repository and build the
application. The instructions are provided below. You can use curl to query the application. Run
curl http://localhost:8080 to see "Hello World".
git clone https://github.com/gingercybersecurity/hello-ginger-rust
cd hello-ginger-rust
sudo apt install gcc
# Install Rust if it is not installed.
# Go to https://rustup.rs for official instructions for installing Rust.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. "$HOME/.cargo/env"
cargo run
# in another terminal run curl http://localhost:8080/
Compile for GingerOS
The application should be statically compiled to produce a single binary that has no dependencies. This eliminates the requirement to install libc and other dependencies inside a GingerOS instance.
sudo apt install musl-tools
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS='-C target_feature=+crt-static' cargo build --release --target x86_64-unknown-linux-musl
Now that you've completed the first step of testing the application in the development environment and building the binaries, you can continue to the Deployment Steps to create the disk image and launch your virtual machine.