Skip to content

Instantly share code, notes, and snippets.

@mhenrixon
Forked from mdub/docker-compose.yml
Created March 23, 2017 10:33
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 mhenrixon/a5135d9c8f748a71fd331d3fa0c6b63c to your computer and use it in GitHub Desktop.
Save mhenrixon/a5135d9c8f748a71fd331d3fa0c6b63c to your computer and use it in GitHub Desktop.
How to share a /usr/local/bundle cache between Ruby build jobs
version: "2"
services:
dev:
image: ruby:2.3
volumes:
- .:/project
- ruby2.3-bundle-cache:/usr/local/bundle
working_dir: /project
volumes:
ruby2.3-bundle-cache:
external: true
#! /bin/bash -e
#
# Run rake inside a docker-compose sandbox
cd $(dirname $0)/..
trap "docker-compose down --volumes" 0
docker volume create --name ruby2.3-bundle-cache > /dev/null
docker-compose run --rm dev sh -c 'bundle check > /dev/null || flock $GEM_HOME bundle install'
docker-compose run --rm dev bundle exec rake "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment