← Writing

Deploying a Dioxus fullstack app to Fly.io

2026-05-28#fly#deployment#docker#dioxus

The Dockerfile

A two-stage build keeps the final image small:

FROM rust:1.87 AS builder
RUN cargo install dioxus-cli
RUN dx build --release --features server

FROM debian:bookworm-slim
COPY --from=builder /app/target/dx/web/release/server /app/server
ENTRYPOINT ["/app/server"]

fly.toml

The key settings:

  • [http_service] with force_https = true
  • min_machines_running = 1 to avoid cold starts
  • auto_stop_machines = "stop" to save cost overnight

Secrets

fly secrets set DATABASE_URL=...
fly secrets set RESEND_API_KEY=...
fly secrets set STRIPE_SECRET_KEY=...

Zero-downtime deploys

Fly's rolling deploy strategy works out of the box. The health check endpoint (/api/health) lets Fly know when the new instance is ready before draining the old one.