Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fluxrad
Created September 22, 2014 19:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fluxrad/b7d6cda5af4a5e250974 to your computer and use it in GitHub Desktop.
Save fluxrad/b7d6cda5af4a5e250974 to your computer and use it in GitHub Desktop.
Dockerfile for a basic rbenv + rails environment
# Inspired by Deepak's setup here - https://gist.github.com/deepak/5925003
FROM ubuntu:14.04
RUN apt-get update -qq && apt-get install -y build-essential nodejs npm git curl mysql-client libmysqlclient-dev
RUN mkdir -p /my_awesome_social_media_app
# Install rbenv
RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
RUN echo '# rbenv setup' > /etc/profile.d/rbenv.sh
RUN echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
RUN echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN chmod +x /etc/profile.d/rbenv.sh
# install ruby-build
RUN mkdir /usr/local/rbenv/plugins
RUN git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
ENV RBENV_ROOT /usr/local/rbenv
ENV PATH $RBENV_ROOT/bin:$RBENV_ROOT/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN rbenv install 2.1.2
RUN bash -l -c 'rbenv global 2.1.2; gem install bundler; rbenv rehash'
WORKDIR /my_awesome_social_media_app
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN ruby -v
RUN bundle install
ADD . /my_awesome_social_media_app
CMD bundle exec rails server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment