I am trying to setup a rails(v4.2.6) application using Passenger(v5.1.4)+Nginx in a docker container. I used official ruby 2.3.1 as base image.
Following is my nginx file for site
server {
server_name example.local;
listen 4000;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /www/app/public;
passenger_ruby /usr/local/bin/ruby;
try_files $uri @passenger;
location @passenger {
passenger_enabled on;
rails_env development;
}
...
}
passenger_pre_start http://0.0.0.0:4000/status;
More context:
- Ruby binary is present at
/usr/local/bin/ruby
- Gems are installed in
/usr/local/bundle
But when I start nginx service, I get following error
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:
passenger is not able to find app gems because, GEM_HOME and GEM_PATH are set wrongly
I have tried to set environment variable GEM_HOME
and GEM_PATH
manually in docker-entrypoint to correct gem path, i.e /usr/local/bundle
. However its not working.
How can I make passenger to use correct gemset.
Note: I am not using rvm
Thanks in advance