Merge pull request #242 from samizdis/master

Addresses issue #197, send SIGTERM through to node
This commit is contained in:
Petr Sloup 2017-12-01 10:52:52 +01:00 committed by GitHub
commit 2afb460191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -5,7 +5,7 @@ ENV NODE_ENV="production"
VOLUME /data VOLUME /data
WORKDIR /data WORKDIR /data
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/usr/src/app/run.sh"] ENTRYPOINT ["/bin/bash", "/usr/src/app/run.sh"]
RUN apt-get -qq update \ RUN apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \ && DEBIAN_FRONTEND=noninteractive apt-get -y install \

13
run.sh
View file

@ -1,4 +1,13 @@
#!/bin/bash #!/bin/bash
_term() {
echo "Caught signal, stopping gracefully"
kill -TERM "$child" 2>/dev/null
}
trap _term TERM
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
echo "Waiting 3 seconds for xvfb to start..." echo "Waiting 3 seconds for xvfb to start..."
sleep 3 sleep 3
@ -6,7 +15,9 @@ sleep 3
export DISPLAY=:99.0 export DISPLAY=:99.0
cd /data cd /data
node /usr/src/app/ -p 80 "$@" node /usr/src/app/ -p 80 "$@" &
child=$!
wait "$child"
start-stop-daemon --stop --pidfile ~/xvfb.pid # stop xvfb when exiting start-stop-daemon --stop --pidfile ~/xvfb.pid # stop xvfb when exiting
rm ~/xvfb.pid rm ~/xvfb.pid