From 2f6ba72ceaad05f165d0b2ff5394b6498c15ada0 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 13 Sep 2018 14:07:44 +0200 Subject: [PATCH] LXCize OMK build --- openmapkit/Dockerfile | 40 ----------------- .../docker/etc/services.d/.s6-svscan/finish | 3 -- .../docker/etc/services.d/openmapkit/run | 6 --- openmapkit/lxcfile | 43 +++++++++++++++++++ openmapkit/{build.sh => setup.sh} | 0 openmapkit/{ => setup}/etc/init.d/openmapkit | 0 .../srv/openmapkit/conf/settings.js | 0 7 files changed, 43 insertions(+), 49 deletions(-) delete mode 100644 openmapkit/Dockerfile delete mode 100755 openmapkit/docker/etc/services.d/.s6-svscan/finish delete mode 100755 openmapkit/docker/etc/services.d/openmapkit/run create mode 100644 openmapkit/lxcfile rename openmapkit/{build.sh => setup.sh} (100%) rename openmapkit/{ => setup}/etc/init.d/openmapkit (100%) rename openmapkit/{ => setup}/srv/openmapkit/conf/settings.js (100%) diff --git a/openmapkit/Dockerfile b/openmapkit/Dockerfile deleted file mode 100644 index e1c2735..0000000 --- a/openmapkit/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM java -LABEL maintainer="Disassembler " - -RUN \ - # Install NodeJS runtime - apk --no-cache add nodejs - -RUN \ - # Install runtime dependencies - apk --no-cache add python2 - -RUN \ - # Install build dependencies - apk --no-cache add --virtual .deps build-base git py2-pip yarn \ - # Clone OpenMapKit - && git clone --depth 1 https://github.com/posm/OpenMapKitServer /srv/openmapkit \ - && cd /srv/openmapkit \ - && git submodule update --init \ - # Install OpenMapKit dependencies - && pip install -r requirements.txt \ - && yarn \ - && cd frontend \ - && yarn \ - && yarn build \ - # Create OS user - && addgroup -S -g 8007 omk \ - && adduser -S -u 8007 -h /srv/openmapkit -s /bin/false -g omk -G omk omk \ - && chown -R omk:omk /srv/openmapkit \ - # Cleanup - && apk --no-cache del .deps \ - && find /srv/openmapkit -name '.git*' -exec rm -rf {} + \ - && 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 - -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 deleted file mode 100755 index 78d5fdc..0000000 --- a/openmapkit/docker/etc/services.d/.s6-svscan/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -/bin/true diff --git a/openmapkit/docker/etc/services.d/openmapkit/run b/openmapkit/docker/etc/services.d/openmapkit/run deleted file mode 100755 index 091fcc2..0000000 --- a/openmapkit/docker/etc/services.d/openmapkit/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/execlineb -P - -fdmove -c 2 1 -export NODE_ENV production -s6-setuidgid 8007:8007 -/usr/bin/node /srv/openmapkit/server.js diff --git a/openmapkit/lxcfile b/openmapkit/lxcfile new file mode 100644 index 0000000..66c2678 --- /dev/null +++ b/openmapkit/lxcfile @@ -0,0 +1,43 @@ +IMAGE openmapkit +LAYER shared/alpine +LAYER shared/java +LAYER shared/libxml +LAYER shared/python2 +LAYER shared/nodejs +LAYER openmapkit/openmapkit + +FIXLAYER /usr/bin/fix-apk + +RUN EOF + # Install build dependencies + apk --no-cache add --virtual .deps build-base git py2-pip yarn + + # Clone OpenMapKit + git clone --depth 1 https://github.com/posm/OpenMapKitServer /srv/openmapkit + cd /srv/openmapkit + git submodule update --init + + # Install OpenMapKit dependencies + pip install -r requirements.txt + yarn + cd frontend + yarn + yarn build + + # Create OS user + addgroup -S -g 8007 omk + adduser -S -u 8007 -h /srv/openmapkit -s /bin/false -g omk -G omk omk + chown -R omk:omk /srv/openmapkit + + # Cleanup + apk --no-cache del .deps + find /srv/openmapkit -name '.git*' -exec rm -rf {} + + rm -rf /usr/local/share/.cache + rm -rf /root/.cache /root/.config /root/.node-gyp /root/.npm +EOF + +MOUNT /srv/openmapkit/data srv/openmapkit/data + +USER 8007 8007 +ENV NODE_ENV production +CMD /usr/bin/node /srv/openmapkit/server.js diff --git a/openmapkit/build.sh b/openmapkit/setup.sh similarity index 100% rename from openmapkit/build.sh rename to openmapkit/setup.sh diff --git a/openmapkit/etc/init.d/openmapkit b/openmapkit/setup/etc/init.d/openmapkit similarity index 100% rename from openmapkit/etc/init.d/openmapkit rename to openmapkit/setup/etc/init.d/openmapkit diff --git a/openmapkit/srv/openmapkit/conf/settings.js b/openmapkit/setup/srv/openmapkit/conf/settings.js similarity index 100% rename from openmapkit/srv/openmapkit/conf/settings.js rename to openmapkit/setup/srv/openmapkit/conf/settings.js