From 7338676cd5bb0b5568c6b61b75db7c2e4bbfe8ef Mon Sep 17 00:00:00 2001 From: alexandrebryszkowski Date: Mon, 18 Jul 2022 16:07:16 +0200 Subject: [PATCH] Changes in order to build an image with a ruby version below 2.6 on an arm64 arch --- Rakefile | 2 +- install_ruby.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ef00cf3d..cb8cbe26 100644 --- a/Rakefile +++ b/Rakefile @@ -130,7 +130,7 @@ namespace :docker do IO.write('tmp/ruby/.keep', '') end env_args = %w(cppflags optflags).map {|name| ["--build-arg", "#{name}=#{ENV[name]}"] }.flatten - sh 'docker', 'run', '--rm', '--privileged', 'multiarch/qemu-user-static:register', '--reset' if arch + sh 'docker', 'run', '--rm', '--privileged', 'multiarch/qemu-user-static:register', '--reset' if arch && arch != 'arm64' sh 'docker', 'build', '-f', dockerfile, *tag_args, *env_args, '--build-arg', "RUBY_VERSION=#{ruby_version}", '--build-arg', "BASE_IMAGE_TAG=#{ubuntu_version(ruby_version)}", diff --git a/install_ruby.sh b/install_ruby.sh index fb0f7d2e..e231e8b5 100755 --- a/install_ruby.sh +++ b/install_ruby.sh @@ -42,6 +42,11 @@ case $RUBY_VERSION in ;; esac +# Since Ruby 2.6, Bundler is a part of Ruby’s standard library, but below this version we need to install Bundler. + if [ "$(printf '%s\n' "$RUBY_VERSION" "2.6.0" | sort -V | head -n1)" = "$RUBY_VERSION" ]; then + gem install bundler +fi + if test -n "$RUBY_MASTER_COMMIT"; then if test -f /usr/src/ruby/configure.ac; then cd /usr/src/ruby