Skip to content

Instantly share code, notes, and snippets.

@vankop
Last active January 13, 2020 14:13
Show Gist options
  • Save vankop/97ebc6053d3ddeba0cf5497c192c8fd9 to your computer and use it in GitHub Desktop.
Save vankop/97ebc6053d3ddeba0cf5497c192c8fd9 to your computer and use it in GitHub Desktop.
Cache root npm folder in GitLab CI
build:
image: node:10-alpine
stage: build
cache:
key: "$CI_JOB_NAME"
paths:
- cache
except:
- tags
before_script:
- mv cache /root/.npm || echo "No cache found"
- npm set progress=false
- npm config set depth 0
script:
- npm ci
after_script:
- mv /root/.npm cache || echo "No cache found"
artifacts:
paths:
- node_modules
expire_in: 20 minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment