Skip to content

Instantly share code, notes, and snippets.

@jkuchar
Created March 28, 2017 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkuchar/b333099640abc2ac66bc9d654c3dd7c8 to your computer and use it in GitHub Desktop.
Save jkuchar/b333099640abc2ac66bc9d654c3dd7c8 to your computer and use it in GitHub Desktop.
How to cache npm, yarn, bower and composer into /cache folder in GitLab CI
# NPM: cache
RUN npm config set cache /cache/.npm
# bower: cache
ENV bower_storage__packages /cache/.bower/packages
ENV bower_storage__registry /cache/.bower/registry
ENV bower_storage__links /cache/.bower/links
# YARN cache
RUN yarn config set cache-folder /cache/yarn
RUN yarn cache dir
# Composer: make global packages available for execution
ENV PATH ~/.composer/vendor/bin:${PATH}
# Configure Composer
ENV COMPOSER_CACHE_DIR /cache/composer
ENV COMPOSER_NO_INTERACTION 1
@jharris4
Copy link

I'm using self-hosted gitlab, and having trouble getting yarn to work with the /cache/yarn directory. Did you do anything special in gitlab ci to make this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment