Skip to content

Static site

This example builds a static site and serves it with nginx.

Create <base>/conf/site.yaml:

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

There is no runtime field. dpl builds the site and exports /app/dist.

Create <base>/conf/nginx.yaml:

type: http-server
http_port: 80
https_port: false

Create <base>/conf/site-domain.yaml:

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

Use spa: true only if your site needs unknown paths to return index.html.

Terminal window
dpl check site
tar -czf /tmp/site.tar.gz -C path/to/site .
dpl deploy site /tmp/site.tar.gz

If you change the static site, rebuild the tarball and redeploy the app:

Terminal window
tar -czf /tmp/site.tar.gz -C path/to/site .
dpl deploy site /tmp/site.tar.gz