I'm having problems deploying my docker container, primarily due to bundler
not being able to execute it's install
command. Running bundle install
locally with passenger
seems to work just fine, only the deployment procedure causes problems upon setting up the gems.
I am relatively new to Docker
and I wouldn't call myself a Rails
expert. That said, I have difficulties understanding how exactly bundler
manages to mess this whole thing up in this way (especially in conjunction with Docker
).
I'm using the passenger-docker base image if that's of any relevance.
Here is my Gemfile
:
gem 'doorkeeper'
gem 'doorkeeper-jwt'
gem 'aws-sdk-rails'
gem 'rack-cors', :require => 'rack/cors'
gem 'active_model_serializers', github: 'rails-api/active_model_serializers'
gem 'passenger'
gem 'rails', '4.2.6'
gem 'rails-api'
gem 'pg'
gem 'devise'
gem 'schema_plus'
gem 'pusher'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'rspec-rails'
gem 'factory_girl_rails', '~> 4.0'
gem 'database_cleaner'
end
And here is (part of) the Dockerfile
:
RUN mkdir /home/app/myapp
WORKDIR /home/app/myapp
COPY Gemfile /home/app/myapp/
COPY Gemfile.lock /home/app/myapp/
RUN chown -R app:app /home/app/myapp
RUN sudo -u app bundle install --deployment --verbose --path vendor/cache
ADD . /home/app/myapp
RUN chown -R app:app /home/app/myapp
When I try to deploy, I get the following error:
Message from application:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
- Is this app supposed to be run as the
app
user?- Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find rake-11.1.2 in any of the sources (Bundler::GemNotFound)/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:inblock in materialize'
map!'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:inmaterialize'
specs'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:inspecs_for'
requested_specs'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:inrequested_specs'
setup'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:127:insetup'
<top (required)>'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
require'
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:inactivate_gem'
block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:inrunning_bundler'
run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in
/usr/share/passenger/helper-scripts/rack-preloader.rb:100:inpreload_app'
<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in<module:PhusionPassenger>'
<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in