Skip to content

Static sites

Use a static app unit when your project builds files and does not need a running app container.

To make an app static, omit the runtime section.

type: app
image: node:22-alpine
builds:
- files: ["package.json", "package-lock.json"]
script: npm ci
- files: ["*"]
env:
PUBLIC_API_URL: https://api.example.com
script: npm run build
exports:
- source: /app/dist
path: /

Then serve it with a domain unit:

type: domain
server: nginx
hosts: ["example.com"]
routes:
- kind: serve_files
location: /
root: ${site:export}
spa: true

dpl builds the image, copies exported files to the HTTP server state directory, and updates the domain config.

It does not start a service for the static app.

Because there is no runtime:

  • no port is available
  • no health check runs
  • timers are skipped
  • ${site:url} and ${site:socket} are not valid
  • ${site:export} is valid after the app has an active deployment

Set spa: true in domain settings for apps that need all unknown routes to return index.html.

routes:
- kind: serve_files
location: /
root: ${site:export}
spa: true

Leave it false for plain file trees, downloads, and assets.