Phusion passenger sets Rails' environment variable as
production by default and doesn't see ENV in shell. To change this value, you can change
passenger_app_env in nginx configuration file.
I have Docker environment for staging. To set up this in my environment, I added another configuration file in starting script used in
# Some setup commands...
ENV RAILS_ENV production # This is default value. It will be overwritten by `--env` option.
# starting script; start.sh
# Add nginx configuration for setting `passenger_app_env` as RAILS_ENV
RUN echo "passenger_app_env $RAILS_ENV;" > /opt/nginx/conf/00_app_env.conf
rake db:migrate && \