0

I am trying to deploy a Rails application in the Phusion-Passenger Docker image:

https://github.com/phusion/passenger-docker

The Gemfile for the application specifies Ruby version 2.3.1, but the image comes with 2.2.5 by default, so bundle install fails.

I've read the documentation a couple of times, but it isn't clear to me if it is possible to user a different major/minor version of Ruby with this image.

I have tried the following in the Dockerfile

FROM phusion/passenger-full
ARG app_init=default

# Set correct environment variables.
ENV HOME /root

# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]

RUN bash -lc 'rvm install ruby-2.3.1'
RUN bash -lc 'rvm --default use ruby-2.3.1'

Which does install and set Ruby 2.3.1 as the default, the "bundle install" step just times out when the Docker image is building.

When I open a shell to the container, and reset Ruby to 2.2.5, bundle install works.

Is it possible to use this image with Ruby 2.3.1 instead of Ruby 2.2.5?

1 Answer 1

1

I resolved this with a couple of changes.

Firstly, I used the ruby23 variant instead of the full variant:

FROM phusion/passenger-ruby23

This probably wasn't necessary, but it will reduce the size of the built image.

Secondly, I added an extra run command to update the bundler gem:

RUN bash -lc 'rvm install ruby-2.3.1'
RUN bash -lc 'rvm --default use ruby-2.3.1'
RUN gem install bundler

Once I added these changes to the Dockerfile, bundle install worked

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .