From e9cebd38ad63cda5e575d17c7ef27a935fbb274e Mon Sep 17 00:00:00 2001 From: Andreas Peters Date: Mon, 23 Jul 2018 14:31:00 +0200 Subject: [PATCH 1/2] add dockerfile --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..df3b762 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:edge + +LABEL maintainer="Andreas Peters " + +RUN echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ + apk add --no-cache git nodejs npm tini websockify + +COPY ./ /opt/mumble-web/ + +WORKDIR /opt/mumble-web + + +RUN npm install && npm run build + +EXPOSE 80 +ENV MUMBLE_SERVER=mumble.aventer.biz:64738 + +ENTRYPOINT ["/sbin/tini", "--"] +CMD websockify --ssl-target --web /opt/mumble-web/dist 80 "$MUMBLE_SERVER" + From 6bf9b7d53c1bf98c408eab9cf7992a26c6e757cd Mon Sep 17 00:00:00 2001 From: Andreas Peters Date: Mon, 23 Jul 2018 17:38:30 +0200 Subject: [PATCH 2/2] change the dockerimage to run the process as node user --- Dockerfile | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index df3b762..7e141d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,19 +2,34 @@ FROM alpine:edge LABEL maintainer="Andreas Peters " +COPY ./ /home/node + RUN echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ - apk add --no-cache git nodejs npm tini websockify + apk add --no-cache git nodejs npm tini websockify && \ + adduser -D -g 1001 -u 1001 -h /home/node node && \ + mkdir -p /home/node && \ + mkdir -p /home/node/.npm-global && \ + mkdir -p /home/node/app && \ + chown -R node: /home/node -COPY ./ /opt/mumble-web/ +USER node -WORKDIR /opt/mumble-web +ENV PATH=/home/node/.npm-global/bin:$PATH +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +RUN cd /home/node && \ + npm install && \ + npm run build -RUN npm install && npm run build +USER root -EXPOSE 80 +RUN apk del gcc git make g++ + +USER node + +EXPOSE 8080 ENV MUMBLE_SERVER=mumble.aventer.biz:64738 ENTRYPOINT ["/sbin/tini", "--"] -CMD websockify --ssl-target --web /opt/mumble-web/dist 80 "$MUMBLE_SERVER" +CMD websockify --ssl-target --web /home/node/dist 8080 "$MUMBLE_SERVER"