Spotter-VM/openmapkit/Dockerfile

52 lines
1.5 KiB
Docker

FROM alpine:3.7
MAINTAINER Disassembler <disassembler@dasm.cz>
RUN \
# Install Java 1.8 JRE
apk --no-cache add openjdk8-jre-base paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/jre/bin/java \
&& paxctl -cm /usr/lib/jvm/java-1.8-openjdk/bin/java \
# Cleanup
&& apk del paxctl
RUN \
# Install NodeJS runtime
apk --no-cache add nodejs paxctl \
# Fix grsec attributes to loosen memory protection restrictions
&& paxctl -cm /usr/bin/node \
# Cleanup
&& apk del paxctl
RUN \
# Install Python2 runtime
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/AmericanRedCross/OpenMapKitServer /srv/openmapkit \
&& cd /srv/openmapkit \
&& git submodule update --init \
# Install OpenMapKit dependencies
&& pip install -r requirements.txt \
&& npm install libxmljs \
&& yarn \
# 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 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
VOLUME ["/srv/openmapkit/data"]
EXPOSE 8007
USER omk
ENV NODE_ENV production
CMD ["node", "/srv/openmapkit/server.js"]