Created
March 4, 2016 07:10
-
-
Save imjching/58450db042db91be9e48 to your computer and use it in GitHub Desktop.
Utilizing Docker's caching system
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
# Choose the official Ruby 2.3.0 image as our starting point | |
FROM ruby:2.3.0 | |
# Run updates for nokogiri and JS runtime | |
RUN apt-get update -qq && apt-get install -y build-essential libxml2-dev libxslt1-dev nodejs | |
# Cleanup | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
# Set up working directory | |
RUN mkdir /app | |
# Copy Gemfiles and install gems | |
WORKDIR /tmp | |
COPY Gemfile Gemfile | |
COPY Gemfile.lock Gemfile.lock | |
RUN bundle install | |
# Everything up to here was cached. This includes | |
# the bundle install, unless the Gemfiles changed. | |
# Change back to app directory | |
WORKDIR /app | |
ADD . /app # optional if we mount local volumes to /app | |
# Start the server | |
CMD ["rails", "server", "-b", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment