Created
December 9, 2015 18:43
-
-
Save xacaxulu/95ce9dd4bb3c95a2e38a to your computer and use it in GitHub Desktop.
Dockerfile
This file contains hidden or 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:14.04 | |
FROM ruby:2.0.0 | |
MAINTAINER James Denman <[email protected]> | |
EXPOSE 3000 | |
ENV RUBY_MAJOR 2.2 | |
ENV RUBY_VERSION 2.2.3 | |
ENV RUBY_DOWNLOAD_SHA256 df795f2f99860745a416092a4004b016ccf77e8b82dec956b120f18bdc71edce | |
ENV RUBYGEMS_VERSION 2.5.0 | |
# skip installing gem documentation | |
RUN echo 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc" | |
# some of ruby's build scripts are written in ruby | |
# we purge this later to make sure our final image uses what we just built | |
RUN apt-get update \ | |
&& apt-get install -y bison libgdbm-dev ruby \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& mkdir -p /usr/src/ruby \ | |
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \ | |
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \ | |
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \ | |
&& rm ruby.tar.gz \ | |
&& cd /usr/src/ruby \ | |
&& autoconf \ | |
&& ./configure --disable-install-doc \ | |
&& make -j"$(nproc)" \ | |
&& make install \ | |
&& apt-get purge -y --auto-remove bison libgdbm-dev ruby \ | |
&& gem update --system $RUBYGEMS_VERSION \ | |
&& rm -r /usr/src/ruby | |
# install things globally, for great justice | |
ENV GEM_HOME /usr/local/bundle | |
ENV PATH $GEM_HOME/bin:$PATH | |
ENV BUNDLER_VERSION 1.10.6 | |
RUN gem install bundler --version "$BUNDLER_VERSION" \ | |
&& bundle config --global path "$GEM_HOME" \ | |
&& bundle config --global bin "$GEM_HOME/bin" | |
# don't create ".bundle" in all our apps | |
ENV BUNDLE_APP_CONFIG $GEM_HOME | |
RUN mkdir -p /usr/src/app | |
COPY . /usr/src/app | |
WORKDIR /usr/src/app | |
RUN gem install bundler && bundle install --jobs 20 --retry 5 | |
CMD ["bin/bundle", "exec", "unicorn", "-p", "3000"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment