Created
October 27, 2016 08:11
-
-
Save chrisedington/deeab25d505201f0a7c47dd2488c3ed7 to your computer and use it in GitHub Desktop.
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
# Use an official, light-weight Ruby image | |
FROM ruby:2.2.3-slim | |
# Install essential Linux packages (use one RUN command to reduce layer complexity) | |
# IF YOU NEED ImageMagick, ADD THESE TO THE END OF THE LINE BELOW: libmagickwand-dev imagemagick | |
# IF YOU NEED MySQL, ADD THESE TO THE LINE BELOW: mysql-server mysql-client libmysqlclient-dev | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client | |
# IF YOU NEED PostgreSQL, uncomment the line below: | |
# RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes libpq-dev | |
# Set the location for where application code will be stored | |
ENV RAILS_ROOT /var/www/myapp | |
# Create the directory where pid files will be stored | |
RUN mkdir -p $RAILS_ROOT/tmp/pids | |
# Set our working directory inside the image | |
WORKDIR $RAILS_ROOT | |
# Use the Gemfiles as Docker cache markers. Always bundle before copying app src. | |
# (the src likely changed and we don't want to invalidate Docker's cache too early) | |
# http://ilikestuffblog.com/2014/01/06/how-to-skip-bundle-install-when-deploying-a-rails-app-to-docker/ | |
COPY Gemfile Gemfile | |
COPY Gemfile.lock Gemfile.lock | |
# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock | |
RUN gem install bundler | |
# Finish establishing our Ruby environment | |
RUN bundle install | |
# Copy the Rails application into place | |
COPY . . | |
# Define the script we want run once the container boots | |
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`) | |
CMD [ "config/containers/myapp.sh" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment