Created
January 8, 2019 15:11
-
-
Save caike/0d4190aee879253254edd1290e053543 to your computer and use it in GitHub Desktop.
Dockerfile template for Rails app
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
# 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"] |
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
#!/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