Add static components to a service to deploy static websites, assets and even binaries!
Static components let you deploy code to an https endpoint that is either public or internal.
The most common use case of a static component is to deploy a JAMstack app or static site.
Static components can also be used to deploy CLI binaries (this is how we deploy pt).
static-public component config looks like:
components: - type: static-public cmd: /app/scripts/cmd route: www.example.com
static-internal component config looks like:
components: - type: static-internal cmd: /app/scripts/cmd route: www-internal.example.com
The build script in each of these configs builds and copies the compiled assets into the `/bundle` directory.
An example of a static component configured to share code from the local code directory into the running service, for live reloads.
components: - type: static-public route: www.example.com # call yarn build and copy output to /bundle cmd: /app/scripts/build # run yarn dev locally and listen on port 3000 for live reloading, withthe local src directory being synced into the # container via a shared mount. dev_cmd: /app/scripts/dev dev_port: 3000 dev_mounts: - src => /app/src
This example is useful for running a modern node website development server inside a container. It will configure
mounting so that when you run
pt dev, your code is synced into your container and live-reload changes occur.
You can run
pt schema validate at any time to validate a service config.
configs for serving websites
configs for local dev
configs for serving files
manifest.jsonfile with file contents and checksums
Versions and manifests are useful when creating a static site to distribute a binary.