Created
November 7, 2016 21:34
-
-
Save rachelmyers/e8c7cbc6a1fbff4aef289de73d50267f to your computer and use it in GitHub Desktop.
Rails with a Puma server example
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, to be 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 . . | |
# Declare arguments that will vary by environment so we can pass them in | |
ARG AWS_ACCESS_KEY_ID | |
ARG AWS_SECRET_ACCESS_KEY | |
# Build your application. | |
RUN \ | |
# Install application gems. | |
bundle install --jobs 4 --without development test --with production && \ | |
# Precompile Rails assets, using the secret keys | |
bundle exec rake AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} RAILS_ENV=production assets:precompile && \ | |
# Clean up build package | |
rm -rf /usr/local/lib/ruby/gems/*/cache/* && \ | |
rm -rf ~/.gem | |
EXPOSE 80 | |
# Run the application. | |
CMD puma --port 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment