1. Layerfile Reference
  2. What are Layerfiles?
  1. Create full-stack environments
  2. Build multi-step CI/CD workflows
  3. Run and parallelize their end-to-end tests

Here’s an example

Layerfiles run top down, and take snapshots as they progress. Consider this configuration:

Layerfile
How it would build

It would:

  1. Start building from a VM with NodeJS version 16 installed,
  2. Copy the repository files into the machine
  3. Install the dependencies with npm install
  4. Start the webserver in the background with npm run start
  5. Wait for the webserver at port 3000 to be running, then expose it as a website

Key idea: Snapshotting the runner state

In the example above, steps like npm install can be re-used between commits unless the files package.json or package-lock.json change.

Webapp.io automatically skips steps like npm install for you by watching which files are read. In the example above, it would take a snapshot of the VM after npm install ran, and notice that the step only read the files package.json and package-lock.json.

If you push another commit which doesn’t change either of those files, the Layerfile build would load the snapshot taken after the step last ran, and skip it entirely.