Skip to content

Commit

Permalink
Merge pull request #242 from samizdis/master
Browse files Browse the repository at this point in the history
Addresses issue #197, send SIGTERM through to node
  • Loading branch information
petrsloup authored Dec 1, 2017
2 parents 83e20b7 + 8eb736b commit 2afb460
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV NODE_ENV="production"
VOLUME /data
WORKDIR /data
EXPOSE 80
ENTRYPOINT ["/usr/src/app/run.sh"]
ENTRYPOINT ["/bin/bash", "/usr/src/app/run.sh"]

RUN apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
Expand Down
13 changes: 12 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
#!/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
echo "Waiting 3 seconds for xvfb to start..."
sleep 3

export DISPLAY=:99.0

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
rm ~/xvfb.pid

0 comments on commit 2afb460

Please sign in to comment.