A similar issue to Issue #13, runs fine when using docker directly, but faile when using rake:
% docker build . --build-arg RUBY_VERSION=2.3.8
[+] Building 24.1s (14/14) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.28kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ruby:2.3.8 0.8s
=> [1/9] FROM docker.io/library/ruby:2.3.8@sha256:78cc821d95c48621e577b6b0d44c9d509f0f2a4e089b9fd0ca2ae86f274773a8 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 55.89kB 0.0s
=> CACHED [2/9] RUN { echo 'install: --no-document'; echo 'update: --no-document'; } >> /etc/gemrc 0.0s
=> CACHED [3/9] WORKDIR /usr/src/app 0.0s
=> [4/9] COPY . . 0.1s
=> [5/9] RUN rm -r Gemfile.lock .ruby-lsp 0.1s
=> [6/9] RUN sed -i '/spec\.add_development_dependency "rubocop"/d' oas_agent.gemspec 0.2s
=> [7/9] RUN if ruby -e 'exit RUBY_VERSION < "2.3"' ; then gem install bundler -v1.17.3; elif ruby -e 'exit RUBY_VERSION < "2.4"' ; then gem install bundler -v '<= 2.3.26'; elif ruby 14.8s
=> [8/9] RUN if ruby -e 'exit RUBY_VERSION < "2.5"'; then bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"; fi 0.3s
=> [9/9] RUN bundle 7.6s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:bc416e6be5f903e6638116b6abfc79dce6f4645431aa6131673563bfa41f6c7d
% docker run -i bc416e6be5f903e6638116b6abfc79dce6f4645431aa6131673563bfa41f6c7d
Your RubyGems version (3.0.3) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems to avoid future breakage and silence this warning by running `gem update --system 3.2.3`
/usr/src/app/lib/agent/agent.rb:24: warning: method redefined; discarding old instance
/usr/local/lib/ruby/2.3.0/singleton.rb:138: warning: previous definition of instance was here
Run options: --seed 32314
# Running:
...........
Finished in 0.001824s, 6029.5977 runs/s, 8770.3239 assertions/s.
11 runs, 16 assertions, 0 failures, 0 errors, 0 skips
The failure:
% VERBOSE=1 rake "test:one[2.2.10]"
#0 building with "desktop-linux" instance using docker driver
#1 [ruby_2_2_10 internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.28kB done
#1 DONE 0.0s
#2 [ruby_2_2_10 internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s
#3 [ruby_2_2_10 internal] load metadata for docker.io/library/ruby:2.2.10
#3 DONE 0.2s
#4 [ruby_2_2_10 1/9] FROM docker.io/library/ruby:2.2.10@sha256:4987b5e2f03b7086c493208ef616b711fe73228391a80faf451975f9e0195236
#4 DONE 0.0s
#5 [ruby_2_2_10 internal] load build context
#5 transferring context: 48.39kB 0.0s done
#5 DONE 0.0s
#6 [ruby_2_2_10 2/9] RUN { echo 'install: --no-document'; echo 'update: --no-document'; } >> /etc/gemrc
#6 CACHED
#7 [ruby_2_2_10 3/9] WORKDIR /usr/src/app
#7 CACHED
#8 [ruby_2_2_10 4/9] COPY . .
#8 DONE 0.0s
#9 [ruby_2_2_10 5/9] RUN rm -r Gemfile.lock .ruby-lsp
#9 DONE 0.1s
#10 [ruby_2_2_10 6/9] RUN sed -i '/spec\.add_development_dependency "rubocop"/d' oas_agent.gemspec
#10 DONE 0.2s
#11 [ruby_2_2_10 7/9] RUN if ruby -e 'exit RUBY_VERSION < "2.3"' ; then gem install bundler -v1.17.3; elif ruby -e 'exit RUBY_VERSION < "2.4"' ; then gem install bundler -v '<= 2.3.26'; elif ruby -e 'exit RUBY_VERSION < "2.6"' ; then gem install bundler -v '<= 2.3.26'; else gem install bundler -v "$(tail -n1 Gemfile.lock | tr -d ' ')"; fi
#11 8.514 Successfully installed bundler-1.17.3
#11 8.514 1 gem installed
#11 DONE 8.5s
#12 [ruby_2_2_10 8/9] RUN if ruby -e 'exit RUBY_VERSION < "2.5"'; then bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"; fi
#12 DONE 0.3s
#13 [ruby_2_2_10 9/9] RUN bundle
#13 0.960 Fetching gem metadata from https://rubygems.org/.......
#13 1.958 Fetching gem metadata from https://rubygems.org/.
#13 1.976 Resolving dependencies...
#13 1.988 Fetching rake 13.0.6
#13 2.087 Installing rake 13.0.6
#13 2.104 Using bundler 1.17.3
#13 2.105 Fetching mini_portile2 2.4.0
#13 2.190 Installing mini_portile2 2.4.0
#13 2.200 Fetching minitest 5.15.0
#13 2.303 Installing minitest 5.15.0
#13 2.328 Fetching msgpack 1.3.3
#13 2.429 Installing msgpack 1.3.3 with native extensions
#13 4.184 Fetching nokogiri 1.9.1
#13 5.017 Installing nokogiri 1.9.1 with native extensions
#13 8.643 Using oas_agent 0.0.1 from source at `.`
#13 8.645 Bundle complete! 5 Gemfile dependencies, 7 gems now installed.
#13 8.645 Bundled gems are installed into `/usr/local/bundle`
#13 DONE 8.7s
#14 [ruby_2_2_10] exporting to image
#14 exporting layers 0.1s done
#14 writing image sha256:ef1ecd385069e442cd95dcdcad3f92441889b88d269d6a115a8ec6410b7a97ae done
#14 naming to docker.io/library/oas_ruby_agent_3-ruby_2_2_10 done
#14 DONE 0.1s
Container oas_ruby_agent_3-ruby_2_2_10-1 Creating
Container oas_ruby_agent_3-ruby_2_2_10-1 Created
Attaching to oas_ruby_agent_3-ruby_2_2_10-1
oas_ruby_agent_3-ruby_2_2_10-1 | /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/lockfile_parser.rb:95:in `initialize'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:83:in `new'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:83:in `initialize'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in `new'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/dsl.rb:234:in `to_definition'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/dsl.rb:13:in `evaluate'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/definition.rb:34:in `build'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler.rb:135:in `definition'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler.rb:101:in `setup'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/gems/bundler-1.17.3/lib/bundler/setup.rb:20:in `<top (required)>'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
oas_ruby_agent_3-ruby_2_2_10-1 | from /usr/local/bundle/bin/rake:27:in `<main>'
oas_ruby_agent_3-ruby_2_2_10-1 exited with code 1
Aborting on container exit...
Container oas_ruby_agent_3-ruby_2_2_10-1 Stopping
Container oas_ruby_agent_3-ruby_2_2_10-1 Stopped
Ruby 2.2.10 ❌ failed, run this version using `rake "test:one[2.2.10]"`
A similar issue to Issue #13, runs fine when using docker directly, but faile when using rake:
The failure: