A Dockerfile that fits
The Dockerfile below listens on $PORT, runs as non-root and writes only to /tmp, the rules the platform checks.
Rust (Axum) deploy guide · Agent Lab Deploy
Add the Dockerfile below to your Rust (Axum) project — or tell Claude Code, Codex or Cursor "deploy this". Agent Lab builds it into a web service, gives every version a preview URL with rollback, and checks uploads for leaked keys. Apps and databases run on Google Cloud in Taiwan.
> deploy this Rust (Axum) app
sites_createmy-rust
sites_deployDockerfile
sites_deploy_statusbuilt · secret scan passed
Live at my-rust--acme.hosting.agentlab.run
Why deploy Rust (Axum) on Agent Lab
Rust project, built from a Dockerfile, deployed as a web service.
The Dockerfile below listens on $PORT, runs as non-root and writes only to /tmp, the rules the platform checks.
Every upload is a new version with its own URL. Look first, then go live; switch back to any version in one click.
Uploads are checked for API keys and credentials before they can go live. Secrets go in the console, never in the code.
Create a database and connect it; the connection is written into the app's environment and the password is never shown.
Your options
Scroll the table sideways.
| What you care about | Agent Lab Deploy | Your own VPS |
|---|---|---|
| Setup | Upload with the Dockerfile below, or say one sentence | SSH, a runtime, a process manager, a reverse proxy |
| HTTPS and domains | Automatic, custom domains on paid plans | Certbot and DNS by hand |
| Preview and rollback | Every version has its own URL; roll back in one click | Write your own scripts |
| Before going live | Uploads checked for leaked keys | Nothing unless you set it up |
| Database | PostgreSQL in one click, connection written into the app | Install and back it up yourself |
| Cost to start | Free plan: NT$0, one size-S app (sleeps when idle) | A VPS at roughly NT$200–600 a month, plus your time |
Steps
Add the Dockerfile below at the top of the project and replace the placeholder names.
Drop the folder on a project's Deploy tab, push from GitHub, or ask your AI tool through Agent Lab MCP.
The platform builds the version and checks it for leaked keys. Enter any secrets it lists in Settings.
The first version goes live once it builds. Later ones get a preview URL; go live when you're happy.
Setup
Replace myapp with the package name in Cargo.toml; Actix Web and Rocket work the same way as long as they listen on 0.0.0.0:$PORT. Install ca-certificates in the second stage, or outbound HTTPS calls fail.
FROM rust:1 AS build
WORKDIR /src
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /src/target/release/myapp /usr/local/bin/myapp
USER 10001
EXPOSE 8080
CMD ["myapp"]
// main.rs:監聽 0.0.0.0:$PORT / listen on 0.0.0.0:$PORT
// let port = std::env::var("PORT").unwrap_or("8080".into());
// let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{port}")).await?;PORT the port the platform gives (8080 by default); the server must listen on it.DATABASE_URL written for you when you connect an Agent Lab PostgreSQL.Read https://app.agentlab.cresclab.com/agent/deploy.md and deploy this Rust (Axum) project to Agent Lab using the Dockerfile at the top. Show me the build plan and the environment variables it needs first, tell me where to enter any secrets, and wait for my OK before it goes live.FAQ