Docker Image: Ruby on Rails with Nginx-Passenger

Summary

Official Centos 6.8: https://hub.docker.com/_/centos/

Ruby: 2.1.7

Nodejs: v6.0.2

Dockerfile

FROM centos:6.8
MAINTAINER Chester4096 <chester4096@bonio.com.tw>
RUN yum update -y && yum install -y which rubygems git libcurl-devel epel-release npm && gem update gem && gem install bundler
RUN gpg2 — keyserver hkp://keys.gnupg.net — recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN \curl -sSL https://get.rvm.io | bash -s stable
ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN /usr/local/rvm/bin/rvm-shell && rvm requirements
RUN /usr/local/rvm/bin/rvm-shell && rvm install 2.1.7
RUN /usr/local/rvm/bin/rvm-shell && rvm use 2.1.7 — default
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
RUN source /root/.bashrc && nvm install v6.2.0

Build Image

docker build -t cent0s6_8_base .

Install Rails

Go into image centos6_8_base, then install manually

docker run -it centos6_8_base
rvm use 2.1.7 — default
gem install rails — no-ri

Install Nginx + Passenger

gem install passenger
passenger-install-nginx-module

Export As Your Image

exit from docker image

exit 

see your container ID

docker ps -a 

Looks like this

Commit your changes

docker commit -m ‘$YOUR_CONTAINER_ID’ $IMAGE_NAME

Login to your Docker-Hub

docker login

Push

docker push $IMAGE_NAME
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.