From 62443134bac8662c8bc2df76e36596b7f81453f0 Mon Sep 17 00:00:00 2001 From: albertchae Date: Tue, 24 Jan 2023 08:33:13 -0800 Subject: [PATCH] Fix Docker build error with rubygems and bundler versions (#900) * Fix error with rubygems-update ``` ERROR: Error installing rubygems-update: There are no versions of rubygems-update (= 3.4.3) compatible with your Ruby & RubyGems rubygems-update requires Ruby version >= 2.6.0. The current ruby version is 2.5.9.229. ERROR: While executing gem ... (Errno::ENOENT) No such file or directory @ dir_chdir - /usr/local/bundle/gems/rubygems-update-3.0.3 ``` Same issue as https://github.com/rubygems/rubygems/issues/2534, following the suggested workaround in the comments there to install an older version of rubygems-update * Pin bundler version to avoid error with Ruby 2.5.9 Without this, we get this error ``` Fetching gem metadata from https://rubygems.org/.......... bundler-2.4.5 requires ruby version >= 2.6.0, which is incompatible with the current version, 2.5.9 ``` According to https://bundler.io/compatibility.html, the highest version of bundler that supports Ruby 2.5.9 is 2.3, so ~> to 2.3.0, which should get us on bundler 2.3.26 but not >= 2.4.0 --- rails/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rails/Dockerfile b/rails/Dockerfile index 245292f91..0184a8194 100644 --- a/rails/Dockerfile +++ b/rails/Dockerfile @@ -17,8 +17,8 @@ RUN apk --no-cache add --update \ libc6-compat \ imagemagick \ ffmpeg && \ - gem update --system --no-document && \ - gem install bundler --no-document --force + gem install rubygems-update -v '<3' --no-document && update_rubygems && \ + gem install bundler --no-document --force -v '~> 2.3.0' WORKDIR /api