Skip to content

Instantly share code, notes, and snippets.

@caike caike/Dockerfile
Created Jan 8, 2019

Embed
What would you like to do?
Dockerfile template for Rails app
# Change Ruby version accordingly
FROM ruby:2.3-stretch
LABEL maintainer="carloshrsouza@gmail.com"
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 server.pid will
# prevent the server from being started.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["rails", "server", "-b", "0.0.0.0"]
#!/bin/bash
set -e
# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid
# 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
You can’t perform that action at this time.