Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ci/caching/index.md')
-rw-r--r--doc/ci/caching/index.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md
index 491454aed28..c634491662d 100644
--- a/doc/ci/caching/index.md
+++ b/doc/ci/caching/index.md
@@ -235,6 +235,39 @@ test_async:
- node ./specs/start.js ./specs/async.spec.js
```
+#### Compute the cache key from the lock file
+
+You can use [`cache:key:files`](../yaml/index.md#cachekeyfiles) to compute the cache
+key from a lock file like `package-lock.json` or `yarn.lock`, and reuse it in many jobs.
+
+```yaml
+# Cache modules using lock file
+cache:
+ key:
+ files:
+ - package-lock.json
+ paths:
+ - .npm/
+```
+
+If you're using [Yarn](https://yarnpkg.com/), you can use [`yarn-offline-mirror`](https://classic.yarnpkg.com/blog/2016/11/24/offline-mirror/)
+to cache the zipped `node_modules` tarballs. The cache generates more quickly, because
+fewer files have to be compressed:
+
+```yaml
+job:
+ script:
+ - echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
+ - echo 'yarn-offline-mirror-pruning true' >> .yarnrc
+ - yarn install --frozen-lockfile --no-progress
+ cache:
+ key:
+ files:
+ - yarn.lock
+ paths:
+ - .yarn-cache/
+```
+
### Cache PHP dependencies
If your project uses [Composer](https://getcomposer.org/) to install