Skip to content

Instantly share code, notes, and snippets.

@spikeheap
Created August 4, 2017 09:08
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 spikeheap/5962b50154fe6757838150a23c84bb4e to your computer and use it in GitHub Desktop.
Save spikeheap/5962b50154fe6757838150a23c84bb4e to your computer and use it in GitHub Desktop.
Faster dependencies for Docker NPM/Bundler (http://ryanbrooks.co.uk/posts/2016-04-28-docker-speedy-dependencies/)
# Requires the following environment variables:
#
# - COMMIT_REF
# - GITHUB_OAUTH_TOKEN
source .env.docker
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/Gemfile?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> Gemfile
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/Gemfile.lock?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> Gemfile.lock
bundle install
# NPM
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/package.json?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> package.json
npm install
# Bower packages, cached
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/.bowerrc?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> .bowerrc
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/bower.json?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> bower.json
./node_modules/.bin/bower install --allow-root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment