From 22af0e4de26a17e69ca7a7268fea2dddded3eb65 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Sat, 13 May 2023 16:49:18 +0100 Subject: [PATCH] Run npm install as abc --- Dockerfile | 15 +++++++-------- Dockerfile.aarch64 | 15 +++++++-------- Dockerfile.armhf | 15 +++++++-------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1e47e3..8ce3bda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,14 +15,13 @@ RUN \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ - npm \ - openssl && \ + npm && \ echo "**** install app ****" && \ mkdir -p \ /opt/mstream && \ if [ -z ${MSTREAM_RELEASE+x} ]; then \ MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ /tmp/mstream.tar.gz -L \ @@ -31,15 +30,15 @@ RUN \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --omit=dev && \ - npm link && \ + chown -R abc:abc ./ && \ + su -s /bin/sh abc -c 'HOME=/tmp npm install --omit=dev' && \ echo "**** cleanup ****" && \ - npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ - rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ rm -rf \ - /tmp/* + $HOME/.cache \ + /tmp/* \ + /tmp/.npm # add local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 7e98292..0a720bf 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -15,14 +15,13 @@ RUN \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ - npm \ - openssl && \ + npm && \ echo "**** install app ****" && \ mkdir -p \ /opt/mstream && \ if [ -z ${MSTREAM_RELEASE+x} ]; then \ MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ /tmp/mstream.tar.gz -L \ @@ -31,15 +30,15 @@ RUN \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --omit=dev && \ - npm link && \ + chown -R abc:abc ./ && \ + su -s /bin/sh abc -c 'HOME=/tmp npm install --omit=dev' && \ echo "**** cleanup ****" && \ - npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ - rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ rm -rf \ - /tmp/* + $HOME/.cache \ + /tmp/* \ + /tmp/.npm # add local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index bcf7f27..0a8bdf8 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -15,14 +15,13 @@ RUN \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ - npm \ - openssl && \ + npm && \ echo "**** install app ****" && \ mkdir -p \ /opt/mstream && \ if [ -z ${MSTREAM_RELEASE+x} ]; then \ MSTREAM_RELEASE=$(curl -sX GET "https://api.github.com/repos/IrosTheBeggar/mStream/releases/latest" \ - | awk '/tag_name/{print $4;exit}' FS='[""]'); \ + | awk '/tag_name/{print $4;exit}' FS='[""]'); \ fi && \ curl -o \ /tmp/mstream.tar.gz -L \ @@ -31,15 +30,15 @@ RUN \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --omit=dev && \ - npm link && \ + chown -R abc:abc ./ && \ + su -s /bin/sh abc -c 'HOME=/tmp npm install --omit=dev' && \ echo "**** cleanup ****" && \ - npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ - rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ rm -rf \ - /tmp/* + $HOME/.cache \ + /tmp/* \ + /tmp/.npm # add local files COPY root/ /