Cache

The cache field is responsible for declaring what parts of your project directory you'd like to cache on disk for subsequent runs. For example, in a typical react application, you may want to cache the contents of .yarn/cache .

Cache Structure

The cache directive accepts a list of entries, each of which has a path field and file field, like so:

cache:
- file: foo-file.foo
path: foo-path/
- file: bar-file.bar
path: bar-path/

Cache Behavior

For the foo example above, Reploy will create a cache entry which points to foo-path on the first run, and only when foo-file.foo changes will Reploy invalidate the cache.

In summary, the file field is used for cache validation, and the path tells Reploy where to look for the contents of your cache.

Example

For yarn :

cache:
- file: yarn.lock
path: node_modules
services:
frontend:
build: yarn install --frozen-lockfile --production --prefer-offline