spin build and spin up: Fermyon Spin Apps
spin build compiles the components of a Fermyon Spin application and spin up runs them locally.
Spin is Fermyon serverless wasm framework. Its CLI compiles each component (often Rust or JS) per the spin.toml manifest and serves them, a natural pair of CI steps: build then smoke-test.
What it does
spin build reads spin.toml and runs each component build command, producing the wasm each trigger points to. spin up starts the runtime, wiring HTTP or other triggers so you can hit the app. spin registry push publishes it as an OCI artifact.
Common usage
spin build
spin up
spin up --listen 127.0.0.1:3000
spin build --up # build then run in one stepOptions
| Command / flag | What it does |
|---|---|
| spin build | Run each component build command from spin.toml |
| --up | After building, start the app immediately |
| spin up | Run the built application locally |
| --listen <addr:port> | Address for the HTTP trigger to bind |
| -f <file> | Use a specific manifest instead of ./spin.toml |
In CI
Install the wasm targets each component needs (for Rust components, rustup target add wasm32-wasip1) before spin build. Run spin up --listen 127.0.0.1:PORT in the background, wait for the port, curl the endpoint, then stop it. Cache the toolchain and target directories.
Common errors in CI
"spin: command not found" means the CLI is not installed. "Error: Failed to build component ..." wraps the underlying compiler error, often a missing wasm target (rustup target add wasm32-wasip1). "Error: address already in use" means the --listen port is taken; pick another. A build without the right target fails inside the component build command.