Fly.ioTutorial
Deno on Fly
Summary
Deno on Fly explains how to package and deploy a Deno 1.0 application using a Dockerfile rather than a buildpack. The example uses the hellodeno-dockerfile project, with an Alpine Linux and Deno 1.0.0 base image, port 8080, a non-root deno user, and separate dependency and application caching layers. A deps.ts file pins imported package versions, while the Dockerfile runs deno cache deps.ts and deno cache server.ts before starting server.ts with deno run --allow-net server.ts. After local Docker testing, the deployment flow uses flyctl init to create the Fly app and fly.toml, then flyctl deploy to build and push the image. The resulting application is available at a Fly hostname, with HTTP and TLS routing to port 8080, automatic HTTPS redirection, and the option to scale globally and add domains with generated certificates.
Context
The post presents Dockerfiles as an alternative to buildpacks for deploying Deno on Fly. It says Dockerfiles provide control over packaging, avoid buildpack assumptions, and can produce smaller images and faster build times for users comfortable with Dockerfile syntax.
Approach / What changed
The example builds a Deno 1.0 application from an Alpine-based Deno image, exposes port 8080, uses the non-root deno user, caches dependencies and application code in separate Docker layers, tests the image locally, and deploys it with flyctl init followed by flyctl deploy.
Takeaways
The Dockerfile uses hayd/alpine-deno:1.0.0, exposes port 8080, switches to the deno user, and starts the application with deno run --allow-net server.ts.
Caching deps.ts before copying the remaining application files places dependencies in their own Docker image layer; server.ts is cached in a later step.
Fly deployment creates a hostname with HTTP and TLS routes to port 8080, redirects requests to HTTPS, and supports global scaling and additional domains with automatically generated certificates.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.