Skip to content

Instantly share code, notes, and snippets.

@keiththomps
Created February 26, 2017 11:41
Show Gist options
  • Save keiththomps/d539eddb66b5601a53414326db4da89e to your computer and use it in GitHub Desktop.
Save keiththomps/d539eddb66b5601a53414326db4da89e to your computer and use it in GitHub Desktop.
These modifications will allow you to restart a container that is using puma as the app server. Create a `script` directory (`mkdir script`), and add the `start` script to it. `start` will need to be made executable (`chmod +x script/start`). The only line in the Dockerfile that should change is the `CMD` line. Rebuild the `app` image.
FROM ruby:2.3.1
RUN apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
postgresql-client \
nodejs \
&& apt-get -q clean \
&& rm -rf /var/lib/apt/lists
# Pre-install gems with native extensions
RUN gem install nokogiri -v "1.6.8.1"
WORKDIR /usr/src/app
COPY Gemfile* ./
RUN bundle install
COPY . .
CMD script/start
#!/bin/bash -e
if [[ -a /tmp/puma.pid ]]; then
rm /tmp/puma.pid
fi
rails server -b 0.0.0.0 -P /tmp/puma.pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment