Run an Astro App

Getting an application running on is essentially working out how to package it as a deployable image. Once packaged it can be deployed to the global application platform.

In this guide we’ll learn how to deploy an Astro application on

You can deploy your Astro app on with minimal effort, our CLI will do the heavy lifting. You can use your existing Astro app or you can create one from scratch.

Astro applications can to be served as either static pages or with server-side rendering (SSR). On this page you’ll find guides to deploying both varieties.

Deploy a static Astro site

First, install flyctl, your app command center, and sign up to if you haven’t already.

Next, if you don’t already have an existing Astro application, you can create one quickly with the following command:

npm create astro@latest

Once your project is ready, you’re ready to start deploying! If you don’t already have a Dockerfile, fly launch will generate one for you, as well as prepare a fly.toml file.

cd my-astro-app
fly launch
Scanning source code
Detected an Astro app
Creating app in [redacted]/my-astro-app
We're about to launch your NodeJS app on Here's what you're getting:

Organization: Your Name                (fly launch defaults to the personal org)
Name:         my-astro-app             (derived from your directory name)
Region:       Seattle, Washington (US) (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM   (most apps need about 1GB of RAM)
Postgres:     <none>                   (not requested)
Redis:        <none>                   (not requested)

? Do you want to tweak these settings before proceeding? (y/N) No
Created app 'my-astro-app' in organization 'personal'
Admin URL:
installing: npm install @flydotio/dockerfile@latest --save-dev


found 0 vulnerabilities
     create  Dockerfile
Wrote config file fly.toml
Validating [redacted]/my-astro-app/fly.toml
Platform: machines
✓ Configuration is valid

==> Building image
--> Building image done
==> Pushing image to fly
--> Pushing image done

Watch your deployment at

Provisioning ips for my-astro-app
  Dedicated ipv6: 2a09:6739:1::30:xxxx:0
  Shared ipv4:
  Add a dedicated ipv4 with: fly ips allocate-v4

This deployment will:
 * create 2 "app" machines

No machines in group app, launching a new machine
Creating a second machine to increase service availability
Finished launching new machines
NOTE: The machines for [app] have services with 'auto_stop_machines = true' that will be stopped when idling

Checking DNS configuration for

Visit your newly deployed app at

That’s it! Run fly apps open to see your deployed app in action.

Try a few other commands:

Deploy an Astro site with SSR

Astro supports server-side rendering (SSR) through the use of adapters. There are a handful of adapters that are officially maintained by the Astro team. When using the @astrojs/node adapter, will automatically detect this during fly launch and if no existing Dockerfile is found, it will generate a new one with the appropriate start command and environment variables.

You can add the necessary Node adapter like so:

npx astro add node

This will install @astrojs/node and make the appropriate changes to your astro.config.* file in one step.

Generating your Astro Dockerfile

As discussed earlier, running fly launch will generate a Dockerfile for you if one does not already exist. Separately, you can also generate your Dockerfile using Dockerfile generator. Once installed, it can be run using npx dockerfile for Node applications or bunx dockerfile for Bun applications. You’ll see it referenced throughout this article for various use cases.