Skip to content

Instantly share code, notes, and snippets.

@bushong1
Last active August 22, 2018 15:12
Show Gist options
  • Save bushong1/5fbb65c27e4356c1cff320ea2fde0695 to your computer and use it in GitHub Desktop.
Save bushong1/5fbb65c27e4356c1cff320ea2fde0695 to your computer and use it in GitHub Desktop.
Update Gemfile.lock using Docker without Ruby installed locally
#!/bin/bash
if [ ! -f ./Gemfile.lock ]; then
# No Gemfile.lock present, create a new one
touch Gemfile.lock
fi
if [ -f ./.ruby-version ]; then
ruby_version="$(cat .ruby-version)"
else
ruby_version="latest"
fi
docker run \
--mount type=bind,source="$(pwd)/Gemfile",target=/Gemfile \
--mount type=bind,source="$(pwd)/Gemfile.lock",target=/Gemfile.lock \
ruby:${ruby_version} \
bundle lock --update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment