Skip to content

Feature: bundle install --bundler to install version required by Gemfile.lock/gems.locked #4264

@svoop

Description

@svoop

Dockerizing my pet project apps on top of Ruby images, I'm often seeing this while building images:

Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.2.4). We suggest you to upgrade to the version that created the lockfile by running gem install bundler:2.2.4.

This mostly is no big deal, at least if the Ruby image is based on the same Ruby version as where the gems.locked/Gemfile.lock was created. However, it would be nice to install the correct version of Bundler before the actual bundle.

Currently, the Bundler version has to be extracted from gems.locked/Gemfile.lock by use of external commands which the image must feature:

RUN bundle config set without 'development test' && \
  version=$(grep -iA1 "bundled with" gems.locked | tail -n 1 | awk '{$1=$1};1') && \
  (if [ -n "$version" ]; then gem install bundler:$version; fi) && \
  bundle install --jobs 20 --retry 5

How about teaching Bundler a new trick to do the same?

RUN bundle config set without 'development test' && \
  bundle install --bundler && \
  bundle install --jobs 20 --retry 5

What are the chances for such an enhancement to be merged?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions