From 98cfa74e88f62d725993878cbeab99a55a32ef8a Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 29 Apr 2018 21:58:33 +0200 Subject: [PATCH] Migrate OpenMapKit to S6 supervisor --- openmapkit/Dockerfile | 10 +++++----- openmapkit/docker/etc/services.d/.s6-svscan/finish | 3 +++ openmapkit/docker/etc/services.d/openmapkit/run | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100755 openmapkit/docker/etc/services.d/.s6-svscan/finish create mode 100755 openmapkit/docker/etc/services.d/openmapkit/run diff --git a/openmapkit/Dockerfile b/openmapkit/Dockerfile index 4a38173..160604b 100644 --- a/openmapkit/Dockerfile +++ b/openmapkit/Dockerfile @@ -10,8 +10,8 @@ RUN \ && apk --no-cache del paxctl RUN \ - # Install Python2 runtime - apk --no-cache add python2 + # Install runtime dependencies + apk --no-cache add python2 s6 RUN \ # Install build dependencies @@ -34,9 +34,9 @@ RUN \ && rm -rf /usr/local/share/.cache \ && rm -rf /root/.cache /root/.config /root/.node-gyp /root/.npm +COPY docker/ / + VOLUME ["/srv/openmapkit/data"] EXPOSE 8080 -USER omk -ENV NODE_ENV production -CMD ["node", "/srv/openmapkit/server.js"] +CMD ["s6-svscan", "/etc/services.d"] diff --git a/openmapkit/docker/etc/services.d/.s6-svscan/finish b/openmapkit/docker/etc/services.d/.s6-svscan/finish new file mode 100755 index 0000000..78d5fdc --- /dev/null +++ b/openmapkit/docker/etc/services.d/.s6-svscan/finish @@ -0,0 +1,3 @@ +#!/bin/sh + +/bin/true diff --git a/openmapkit/docker/etc/services.d/openmapkit/run b/openmapkit/docker/etc/services.d/openmapkit/run new file mode 100755 index 0000000..091fcc2 --- /dev/null +++ b/openmapkit/docker/etc/services.d/openmapkit/run @@ -0,0 +1,6 @@ +#!/bin/execlineb -P + +fdmove -c 2 1 +export NODE_ENV production +s6-setuidgid 8007:8007 +/usr/bin/node /srv/openmapkit/server.js