Skip to content

Instantly share code, notes, and snippets.



Created Jan 8, 2019
What would you like to do?
Dockerfile template for Rails app
# Change Ruby version accordingly
FROM ruby:2.3-stretch
LABEL maintainer=""
RUN apt-get update
RUN apt-get install -y git
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
# This is a quick fix for a known issue
# where a value written to will
# prevent the server from being started.
COPY /usr/bin/
RUN chmod +x /usr/bin/
CMD ["rails", "server", "-b", ""]
set -e
# Remove a potentially pre-existing for Rails.
rm -f /myapp/tmp/pids/
# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment