pier_

Deploy a static site

Publish a directory of files — or a framework build — to the edge with its own HTTPS hostname

Goal. acme's www/ (an index.html) is served at an HTTPS hostname. A site is a set of files served from the edge, not a container: it has no port, no plan and no instance.

Declare the site

pier.yaml
environments:
  prod:
    sites:
      - name: www
        build_context: ./www
        targets:
          - name: primary

pier apply (or pier deploy) creates the site and its hostname. Files are published by a deploy of the site itself.

Publish the files

pier deploy www --path ./www --skip-build
output
→  Building site www from ./www
→  Found 1 site files to deploy
→  All 1 files already stored — nothing to upload
→  Finalizing deploy...
OK  Deployed site "www"
Name    www
Status  active
Files   1
URL     https://6aeqkcz34yr.site.pier.run

--path is the directory to upload; --skip-build uploads it as it is. Without --skip-build, Pier detects the framework (Next.js, Astro, Vite, Hugo, …) and runs its build first, uploading the output directory.

pier ls sites
output
                                                     
 NAME STATUS URL                                     
                                                     
 www  active https://6aeqkcz34yr.site.pier.run 
                                                     

What changed

The sites: block above. The upload is recorded as a deploy of www (pier deploys ls www), so pier rollback www returns to the previous bundle.

Variations

  • Framework build: pier deploy www --path . from a Vite or Next.js project runs the detected build; --build-cmd and --output-dir override what was detected, and framework:, build_command:, output_dir: on the target make it permanent.
  • Single-page app: spa_fallback: true on the target serves index.html for unknown paths. Redirects, rewrites and headers are pier routes.
  • On push: connect the repository; each push to the target's branch then publishes (Deploy from GitHub).

See also

Sites · pier deploy · pier routes

On this page