Layerfile Reference
What are Layerfiles?
Webapp.io uses files called Layerfile to let our users:
- Create full-stack environments
- Build multi-step CI/CD workflows
- 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:
- Start building from a VM with NodeJS version 16 installed,
- Copy the repository files into the machine
- Install the dependencies with
npm install
- Start the webserver in the background with
npm run start
- 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.