Last active
October 7, 2016 01:16
-
-
Save rachelmyers/5a7e0daad6b0599c6aa5b0feb72f534f to your computer and use it in GitHub Desktop.
An annotated Dockerfile for Rails, running Ruby 2.2.5
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
| # Our base image is Ruby 2.2; it will run on Amazon Linux. | |
| FROM ruby:2.2 | |
| # This isn't required, but give yourself some credit | |
| MAINTAINER Your Name Here <Your Email Here> | |
| # If you get a library from Homebrew (or `apt-get`) to run it locally, add it to | |
| # here, and it will be installed with `apt-get`. | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| nodejs \ | |
| tzdata | |
| # Copy the application into the docker container. | |
| COPY . . | |
| # run `bundle` and `assets:precompile` to do the bulk of the work. | |
| RUN \ | |
| # Install application gems. | |
| bundle install --jobs 4 --without development test --with production && \ | |
| # Precompile Rails assets. | |
| RAILS_ENV=production bundle exec rake assets:precompile && \ | |
| # Clean up build package | |
| rm -rf /usr/local/lib/ruby/gems/*/cache/* && \ | |
| rm -rf ~/.gem | |
| # Start the application :tada: | |
| CMD bin/rails server --port 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment