Public Repository

Last pushed: 2 years ago
Short Description
rbenv and ruby-build setup with ubuntu 14.04 base
Full Description

Dockerfile

FROM ubuntu:14.04

RUN apt-get update && apt-get install -y \
      curl \
    nano \
    git-core \
    git \
    nodejs \
    autoconf bison build-essential libssl-dev \
    libyaml-dev libreadline6-dev zlib1g-dev \
    libncurses5-dev libffi-dev libgdbm3 libgdbm-dev \  
 && rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash rails

USER rails

ENV MYHOME=/home/rails


# install rbenv and ruby-build

RUN git clone https://github.com/rbenv/rbenv.git $MYHOME/.rbenv

RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $MYHOME/.bash_profile

RUN echo 'eval "$(rbenv init -)"' >> $MYHOME/.bash_profile

RUN git clone https://github.com/rbenv/ruby-build.git $MYHOME/.rbenv/plugins/ruby-build

# when docker run, cd to $HOME and set up rbenv for the first time based on https://github.com/rbenv/rbenv






# after choosing ruby version and installed it, add rails gem and put your app in /home/rails/app

WORKDIR $MYHOME/app

EXPOSE 3000 3001

CMD ["rails", "s", "-b", "0.0.0.0"]

When docker run for the first time then:

 cd /home/rails && .rbenv/bin/rbenv && source .bash_profile

After installing ruby and Rails,

rails new app # options
Docker Pull Command
Owner
fasilx

Comments (0)