Skip to content

Instantly share code, notes, and snippets.

@shunwen
Created May 21, 2014 13:56
Show Gist options
  • Save shunwen/fddfa32ac3689fdbd42d to your computer and use it in GitHub Desktop.
Save shunwen/fddfa32ac3689fdbd42d to your computer and use it in GitHub Desktop.
Dockerfile Rails
FROM ubuntu:14.04
MAINTAINER Shunwen Hsiao, "https://github.com/shunwen"
RUN apt-get update
RUN apt-get install -qy git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common vim
RUN apt-get clean
# Install nodejs for js runtime
RUN add-apt-repository ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get -y install nodejs
RUN apt-get clean
RUN node -v
# Install rbenv and ruby
RUN git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
ENV PATH $HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH
RUN echo 'eval "$(rbenv init -)"' >> ~/.bashrc
RUN rbenv install 2.1.2
RUN rbenv global 2.1.2
RUN echo $PATH
RUN ruby -v
RUN echo "gem: --no-ri --no-rdoc" > ~/.gemrc
RUN gem install bundler && rbenv rehash
ADD try_docker /rails
EXPOSE 3000
WORKDIR /rails
RUN bundle install && rbenv rehash
RUN rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment