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
environments:
prod:
sites:
- name: www
build_context: ./www
targets:
- name: primarypier 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→ 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
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-cmdand--output-diroverride what was detected, andframework:,build_command:,output_dir:on the target make it permanent. - Single-page app:
spa_fallback: trueon the target servesindex.htmlfor unknown paths. Redirects, rewrites and headers arepier routes. - On push: connect the repository; each push to the target's branch then publishes (Deploy from GitHub).