docker-compose build failed due to ruby version
Closed this issue · 6 comments
I've restart from scratch the README.md
$ docker-compose build
[...]
Step 20/23 : COPY Gemfile /app
---> 68862ef27233
Step 21/23 : COPY Gemfile.lock /app
---> f702256d0bc5
Step 22/23 : RUN bundle install
---> Running in 192dcfc46758
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Your Ruby version is 2.4.3, but your Gemfile specified 2.4.4
ERROR: Service 'app' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 18
Do you have the lastest source on development branch?
I guess the answer is yes:
$ git status
On branch development
Your branch is up-to-date with 'origin/development'.
nothing to commit, working directory clean
@mjy I've to find why ...
Your Ruby version is 2.4.3, but your Gemfile specified 2.4.4
ERROR: Service 'app' failed to build: The command '/bin/sh -c bundle install' returned a non-zero code: 18
$
$ ruby --version
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.4.4 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ rvm use
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore ./Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
Using ~/.rvm/gems/ruby-2.4.4
$
$ which ruby
/usr/share/rvm/rubies/ruby-2.4.4/bin/ruby
$ aptitude search ruby2.4.3
$
$ rvm current
ruby-2.4.4
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.14.1
- RUBY VERSION: 2.4.4 (2018-03-28 patchlevel 296) [x86_64-linux]
- INSTALLATION DIRECTORY: ~/.rvm/gems/ruby-2.4.4
- USER INSTALLATION DIRECTORY: ~/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /usr/share/rvm/rubies/ruby-2.4.4/bin/ruby
- EXECUTABLE DIRECTORY: ~/.rvm/gems/ruby-2.4.4/bin
- SPEC CACHE DIRECTORY: ~/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- ~/.rvm/gems/ruby-2.4.4
- ~/.rvm/gems/ruby-2.4.4@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- /usr/share/rvm/rubies/ruby-2.4.4/bin
- /usr/share/rvm/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.1/bin
- ~/.rvm/gems/ruby-2.4.1@global/bin
- ~/.rvm/gems/ruby-2.4.1/bin
- ~/.rvm/gems/ruby-2.4.1@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.4/bin
- ~/.rvm/gems/ruby-2.4.4@global/bin
- ~/.rvm/gems/ruby-2.4.1/bin
- ~/.rvm/gems/ruby-2.4.1@global/bin
- /usr/games
- /usr/games
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
- /usr/lib/jvm/java-7-oracle/bin
- /usr/lib/jvm/java-7-oracle/db/bin
- /usr/lib/jvm/java-7-oracle/jre/bin
- /usr/lib/jvm/java-7-oracle/bin
- /usr/lib/jvm/java-7-oracle/db/bin
- /usr/lib/jvm/java-7-oracle/jre/bin
@mjy In fact, I had RUN ruby --version
in Dockerfile.development and the answer is:
Step 8/24 : RUN ruby --version
---> Running in 5acb1a8e99b8
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux-gnu]
I'm wondering if it could came from this https://github.com/SpeciesFileGroup/taxonworks/blob/development/Dockerfile.development#L14 and this https://github.com/SpeciesFileGroup/taxonworks/blob/development/Dockerfile.development#L26
It does not install the right version
After few modifications (https://github.com/drecom/docker-ubuntu-ruby/blob/2.4.4/Dockerfile), I'm able to use the right version:
Step 17/34 : RUN ruby --version
---> Using cache
---> 3bd5ff18f5da
Step 18/34 : RUN gem --version
---> Running in c6784172daa1
2.7.6
But then, I've another trouble:
Step 29/34 : RUN gem install bundler && bundler config --global path "$GEM_HOME" && bundle config --global bin "$GEM_HOME/bin" && mkdir /app
---> Running in 793314ee103d
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Done installing documentation for bundler after 3 seconds
1 gem installed
/usr/local/rbenv/versions/2.4.4/lib/ruby/site_ruby/2.4.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)
from /usr/local/rbenv/versions/2.4.4/lib/ruby/site_ruby/2.4.0/rubygems.rb:308:in `activate_bin_path'
from /usr/local/rbenv/versions/2.4.4/bin/bundler:23:in `<main>'
ERROR: Service 'app' failed to build: The command '/bin/sh -c gem install bundler && bundler config --global path "$GEM_HOME" && bundle config --global bin "$GEM_HOME/bin" && mkdir /app' returned a non-zero code: 1
I' working on it
A problem came from:
Step 30/37 : RUN bundler config --global path "$GEM_HOME"
---> Running in fe574bfb3edc
/usr/local/rbenv/versions/2.4.4/lib/ruby/site_ruby/2.4.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)
from /usr/local/rbenv/versions/2.4.4/lib/ruby/site_ruby/2.4.0/rubygems.rb:308:in `activate_bin_path'
from /usr/local/rbenv/versions/2.4.4/bin/bundler:23:in `<main>'
ERROR: Service 'app' failed to build: The command '/bin/sh -c bundler config --global path "$GEM_HOME"' returned a non-zero code: 1
It's here:
https://github.com/SpeciesFileGroup/taxonworks/blob/development/Dockerfile.development#L47
bundler config --global path "$GEM_HOME" && \
need to be
bundle config --global path "$GEM_HOME" && \