docker-library/ruby — pull request #1 by benjaminbauer (2014-07-16 12:47:04+00:00)
Title: Makes bundle install cacheable

# Problem
As of now, every time any file in the ruby source that is added (to
/usr/src/app) is changed, bundle install is rerun. This is unnecessary
and can take a substantial amount of time.

# Solution
By copying the Gemfile and Gemfile.lock seperately, Docker can cache the
ADD and the subsequent bundle install. Bundle install will only be rerun
when there is a change in the Gemfile or the Gemfile.lock

This solution is based on:
* http://ilikestuffblog.com/2014/01/06/how-to-skip-bundle-install-when-
deploying-a-rails-app-to-docker/
* https://blog.abevoelker.com/rails-development-using-docker-and-
vagrant/