From e0414b602e1589bb7575f0b55ceba56ab267e6e2 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Mon, 1 Jun 2026 17:35:22 +0500 Subject: [PATCH] Upgrade Ruby to 4.0 via multi-stage build, fix rubocop config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump the bundler group (#170) updated gems to versions requiring Ruby >= 3.2, but the Dockerfile was installing ruby-full via APT (Ruby 3.1 on Debian Bookworm). During docker build, bundler was silently downgrading activesupport 8.1.3 → 7.0.10 to satisfy Ruby 3.1, then COPY . . overwrote Gemfile.lock back to 8.1.3, causing Bundler::GemNotFound at runtime. - Use ruby:4.0-slim-bookworm as multi-stage source for Ruby binaries (bookworm variant ensures GLIBC compatibility with hexletbasics/base-image) - Update .rubocop.yml: plugins: instead of deprecated require:, TargetRubyVersion 4.0, disable Style/ReduceToHash (exercises intentionally use each_with_object) Co-Authored-By: Claude Sonnet 4.6 --- .rubocop.yml | 7 +++++-- Dockerfile | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 62a1484..8754ade 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,9 +4,9 @@ AllCops: Include: - 'lib/**/*.rb' - 'modules/**/*.rb' - TargetRubyVersion: 3.3.0 + TargetRubyVersion: 4.0 -require: +plugins: - rubocop-minitest Style/FrozenStringLiteralComment: @@ -26,5 +26,8 @@ Metrics/MethodLength: Style/EachWithObject: Enabled: false +Style/ReduceToHash: + Enabled: false + Style/AsciiComments: Enabled: false diff --git a/Dockerfile b/Dockerfile index f7cffd6..6c7cb54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ +FROM ruby:4.0-slim-bookworm AS ruby-source FROM hexletbasics/base-image:latest +COPY --from=ruby-source /usr/local /usr/local + ENV RUBYLIB=/exercises-ruby/lib ENV PATH=/exercises-ruby/bin:$PATH -RUN apt-get update && \ - apt-get install -y ruby-full bundler && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +RUN gem install bundler WORKDIR /exercises-ruby