Skip to content

Instantly share code, notes, and snippets.

@rachelmyers
Created September 15, 2016 00:22
Show Gist options
  • Save rachelmyers/34bb6561ba9c48ddf6a24691dabf30fd to your computer and use it in GitHub Desktop.
Save rachelmyers/34bb6561ba9c48ddf6a24691dabf30fd to your computer and use it in GitHub Desktop.
A Dockerfile for a Rails app
FROM ruby:2.3
# Set the base directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
RUN mkdir -p /app
WORKDIR /app
# Copy dependencies into the container
COPY Gemfile Gemfile.lock ./
RUN gem install bundler && bundle install --jobs 20 --retry 5 --without development test
# Set the Rails environment to production
ENV RAILS_ENV production
ENV RACK_ENV production
# Copy the main application into the container
COPY . ./
# Precompile the Rails assets
RUN bundle exec rake assets:precompile
# Start the application with Puma
CMD bundle exec puma -C config/puma.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment