-run_bundler --without=development
-bundle exec passenger-config build-native-support
-bundle exec passenger-config install-standalone-runtime
+if test -s $ARVADOS_CONTAINER_PATH/api_rails_env ; then
+ export RAILS_ENV=$(cat $ARVADOS_CONTAINER_PATH/api_rails_env)
+else
+ export RAILS_ENV=development
+fi
+
+run_bundler --without=development --binstubs
+flock $GEM_HOME/gems.lock bin/passenger-config build-native-support
+flock $GEM_HOME/gems.lock bin/passenger-config install-standalone-runtime