简体   繁体   English

在 dockerfile 中使用 apt get 安装适当版本的 ruby​​-bundler

[英]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?如何安装与我尝试将我的应用程序更新到的 Ruby 版本配套的适当捆绑程序版本?

Previous command in dockerfile apt-get install -y ruby3.5 ruby3.5-dev ruby-bundler 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修改 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.当我运行 dockerfile 并尝试运行bundle install时,我收到此错误。 I'm also not sure if the sprockets error is due to the bundler being out of date.我也不确定sprockets错误是否是由于捆绑器已过时。

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.如果您需要更多控制,我建议您不要从 deb package 安装它,而是通过gem install 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} \
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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