Created
October 25, 2015 08:56
-
-
Save colby-swandale/234a5193f58e140acec9 to your computer and use it in GitHub Desktop.
Dockerfile with rbenv and ruby-install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:latest | |
MAINTAINER Colby Swandale <[email protected]> | |
# update apt cache and install dependencies | |
RUN apt-get update && apt-get install git curl build-essential libssl-dev libreadline-dev zlib1g-dev sqlite3 libsqlite3-dev -y | |
# add app user | |
RUN adduser --gecos '' --disabled-password app | |
# set user to app | |
USER app | |
# set rbenv, ruby-build bin paths | |
ENV HOME /home/app | |
ENV PATH $HOME/.rbenv/shims:$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH | |
# clone rbenv | |
RUN git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
# clone ruby-build | |
RUN git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
# set working directory to project src | |
WORKDIR /src | |
# add Gemfile, Gemfile.lock, .ruby-version to docker | |
ADD Gemfile Gemfile.lock .ruby-version ./ | |
# install ruby | |
RUN rbenv install | |
# install bundler | |
RUN gem install bundler | |
# install app dependencies | |
RUN bundle install | |
# run rails | |
CMD ["bundle", "exec", "rails", "server"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment