简体   繁体   中英

install appropriate version of ruby-bundler with apt get in dockerfile

How can I install the appropriate bundler version that goes with the Ruby version I am trying to update my app to?

Previous command in dockerfile apt-get install -y ruby3.5 ruby3.5-dev ruby-bundler

Modified dockerfile apt-get install -y ruby3.6 ruby3.6-dev ruby-bundler

When I run my dockerfile, and it attempts to run bundle install I get this error. I'm also not sure if the sprockets error is due to the bundler being out of date.

Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from http://rubygems.org/............
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..

You have requested:
  sprockets = 3.0
The bundle currently has sprockets locked at 2.0
Try running `bundle update sprockets`
If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

If you need more control I'd suggest installing it not from the deb package but via gem install instead. Something like:

FROM <whatever>

ENV RUBYGEMS_VERSION=3.1.2 \
    BUNDLER_VERSION=2.3.9

RUN apt-get update && \
    apt-get -y install <prerequisites, ruby, ...> && \
    gem update --system ${RUBYGEMS_VERSION} && \
    gem install bundler --version ${BUNDLER_VERSION} \
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM