Last active
September 20, 2016 00:30
-
-
Save rachelmyers/6df04f541fc480f3280ca347258c83bb to your computer and use it in GitHub Desktop.
A basic Dockerfile for a Rails app moving off Heroku, without addons
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
# Our base image is Ruby 2.2; it will run on Amazon Linux. | |
FROM ruby:2.2 | |
# Install packages | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
nodejs \ | |
tzdata | |
# Copy your application into the container. | |
COPY . . | |
# Build your application. | |
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 | |
# Run your application. | |
CMD bin/rails server --port 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To move off Heroku:
Dockerfile
to the root of the application; for a plain Rails app, this will work, adjusting this for Ruby versionsdatabase.yml
; it'll be something like this: