2

I am using Ruby version 2.2.0 in my Rails Application and Rails version is 4.2.0. Currently, Project is built through docker, so I am thinking of to upgrade the ruby version with 2.4.0 version.

I believe I need to change the docker image to upgrade the ruby version.

I already check a few of the articles but didn't get enough information.

Docker file

FROM ruby:2.2.0

RUN apt update && \
  apt install -y --no-install-recommends \
  git \
  curl \
  gnupg2 \
  libpq-dev \
  libmysqlclient-dev \
  nodejs \
  graphviz \
  && rm -rf /var/lib/apt/lists/*

Once ruby version upgraded then I will upgrade the rails version. Any help will be appreciated.

Rohit Lingayat
  • 716
  • 6
  • 23

2 Answers2

1

You can always build your own Docker image as such:

FROM ubuntu

RUN apt-get update
RUN apt-get install -y build-essential wget

RUN wget --no-check-certificate -O ruby-install.tar.gz https://github.com/postmodern/ruby-install/archive/master.tar.gz
RUN tar -xzvf ruby-install.tar.gz
RUN cd ruby-install-master && make install
RUN cd /
RUN rm -rf ruby-install-master && rm -rf ruby-install.tar.gz

RUN ruby-install --latest
RUN ruby-install -i /usr/local/ ruby 2.4.0 -- --disable-install-doc

RUN gem update --system --no-document
RUN gem install bundler --force
Kris
  • 19,188
  • 9
  • 91
  • 111
0

depends on how one manages ruby application and ruby version. here are few things i would offer to check:

  1. update Gemfile if bundler is used

    $ cat Gemfile | head -n 1
    ruby '2.4.0'
    
  2. update .ruby-version if rbenv or [rvm][3] is used

    $ cat .ruby-version
    2.4.0
    
  3. update Dockerfile if docker is used

    $ cat Dockerfile | grep FROM
    FROM ruby:2.4.0
    
Mr.
  • 9,429
  • 13
  • 58
  • 82