> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webapp.io/llms.txt
> Use this file to discover all available pages before exploring further.

# What are Layerfiles?

> Webapp.io uses files called Layerfile to let our users:

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:

```docker Layerfile theme={null}
FROM webapp.io/node:16

COPY / /root
RUN npm install
RUN BACKGROUND npm run start
EXPOSE WEBSITE localhost:3000
```

##### 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.
