From 28ade2a8d90e42afea212fa83da17351806a62b2 Mon Sep 17 00:00:00 2001 From: Joerg Reichert Date: Sun, 14 Apr 2019 23:51:40 +0200 Subject: [PATCH] fix finally server pid issue at docker container restart --- Dockerfile | 4 ++++ docker-entrypoint.sh | 8 ++++++++ 2 files changed, 12 insertions(+) mode change 100644 => 100755 Dockerfile create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 index dedb0f5..a65ed1e --- a/Dockerfile +++ b/Dockerfile @@ -16,5 +16,9 @@ RUN bundle install ADD . /app WORKDIR /app +COPY ./docker-entrypoint.sh / +RUN chmod +x docker-entrypoint.sh + EXPOSE 3000 +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["rails", "server", "-b", "0.0.0.0"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..4749050 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ -f ./tmp/pids/server.pid ]; then + rm ./tmp/pids/server.pid +fi + +exec bundle exec "$@"