LXCize OMK build

This commit is contained in:
Disassembler 2018-09-13 14:07:44 +02:00
parent 41b598936f
commit 2f6ba72cea
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
7 changed files with 43 additions and 49 deletions

View File

@ -1,40 +0,0 @@
FROM java
LABEL maintainer="Disassembler <disassembler@dasm.cz>"
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"]

View File

@ -1,3 +0,0 @@
#!/bin/sh
/bin/true

View File

@ -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

43
openmapkit/lxcfile Normal file
View File

@ -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