Last Updated: February 25, 2016
·
9.672K
· igama

Dockerfile for RVM

Example Dockerfile to setup a environment with RVM, to be used for Ruby projects.

#Template Dockerfile for Ruby projects
FROM ubuntu:14.04

RUN apt-get update

## Default Packages
RUN apt-get install -y -q ruby1.9.1 ruby1.9.1-dev build-essential 
RUN apt-get install -y nano wget links curl rsync bc git git-core apt-transport-https libxml2 libxml2-dev libcurl4-openssl-dev openssl sqlite3 libsqlite3-dev
RUN apt-get install -y gawk libreadline6-dev libyaml-dev autoconf libgdbm-dev libncurses5-dev automake libtool bison libffi-dev

## Ruby
RUN curl -L https://get.rvm.io | bash -s stable
#Set env just in case
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN /bin/bash -l -c "rvm requirements"
RUN /bin/bash -l -c "rvm install 2.1.1"
RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"

## Nodejs engine is used in many projects (e.g. execjs)
RUN apt-get install -y nodejs npm
RUN ln -s  /usr/bin/nodejs  /usr/bin/node

3 Responses
Add your response

oh man you are running your app under root. icky

over 1 year ago ·

its docker though.. so.. is that a big deal?

over 1 year ago ·

Why do you set the PATH if you still have to use "/bin/bash -l -c"? Is there a way to use RVM and not have to use "/bin/bash -l -c" when running docker exec for example?

over 1 year ago ·