From c1222b2572224eb9986fe62db4cd26265fe0a565 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Thu, 17 Feb 2022 13:54:42 +0100 Subject: [PATCH] Docker: Add install-nodejs.sh script --- docker/develop/armv7/Dockerfile | 5 +---- docker/develop/bullseye/Dockerfile | 5 +---- docker/develop/buster/Dockerfile | 5 +---- docker/develop/impish/Dockerfile | 5 +---- docker/scripts/install-nodejs.sh | 13 +++++++++++++ 5 files changed, 17 insertions(+), 16 deletions(-) create mode 100755 docker/scripts/install-nodejs.sh diff --git a/docker/develop/armv7/Dockerfile b/docker/develop/armv7/Dockerfile index 6cb27c401..ac1fde961 100644 --- a/docker/develop/armv7/Dockerfile +++ b/docker/develop/armv7/Dockerfile @@ -73,10 +73,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta ffmpegthumbnailer \ libavcodec-extra \ sudo && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ - apt-get update && apt-get -qq install nodejs && \ - npm install --unsafe-perm=true --allow-root -g npm && \ - npm config set cache ~/.cache/npm && \ + /root/.local/bin/install-nodejs.sh && \ apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \ /root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \ mkdir -p "/go/src" "/go/bin" && \ diff --git a/docker/develop/bullseye/Dockerfile b/docker/develop/bullseye/Dockerfile index ef36186c3..8b4226a97 100644 --- a/docker/develop/bullseye/Dockerfile +++ b/docker/develop/bullseye/Dockerfile @@ -86,10 +86,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta chrpath \ lsof \ apache2-utils && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ - apt-get update && apt-get -qq install nodejs && \ - npm install --unsafe-perm=true --allow-root -g npm && \ - npm config set cache ~/.cache/npm && \ + /root/.local/bin/install-nodejs.sh && \ /root/.local/bin/install-darktable.sh ${TARGETARCH} && \ /root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \ apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \ diff --git a/docker/develop/buster/Dockerfile b/docker/develop/buster/Dockerfile index 20aa5f0da..074a42cdd 100644 --- a/docker/develop/buster/Dockerfile +++ b/docker/develop/buster/Dockerfile @@ -85,10 +85,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta chrpath \ lsof \ apache2-utils && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ - apt-get update && apt-get -qq install nodejs && \ - npm install --unsafe-perm=true --allow-root -g npm && \ - npm config set cache ~/.cache/npm && \ + /root/.local/bin/install-nodejs.sh && \ /root/.local/bin/install-darktable.sh ${TARGETARCH} && \ /root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \ apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \ diff --git a/docker/develop/impish/Dockerfile b/docker/develop/impish/Dockerfile index 30527c1dc..20dd868a4 100644 --- a/docker/develop/impish/Dockerfile +++ b/docker/develop/impish/Dockerfile @@ -82,10 +82,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta apache2-utils \ fonts-roboto \ sudo && \ - curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ - apt-get update && apt-get -qq install nodejs && \ - npm install --unsafe-perm=true --allow-root -g npm && \ - npm config set cache ~/.cache/npm && \ + /root/.local/bin/install-nodejs.sh && \ /root/.local/bin/install-darktable.sh ${TARGETARCH} && \ /root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \ /root/.local/bin/install-devtools.sh ${TARGETARCH} && \ diff --git a/docker/scripts/install-nodejs.sh b/docker/scripts/install-nodejs.sh new file mode 100755 index 000000000..90d768074 --- /dev/null +++ b/docker/scripts/install-nodejs.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# abort if the user is not root +if [[ $(id -u) != "0" ]]; then + echo "Usage: run install-nodejs.sh as root" 1>&2 + exit 1 +fi + +# install from nodesource.com +curl -sL https://deb.nodesource.com/setup_16.x | bash - +apt-get update && apt-get -qq install nodejs +npm install --unsafe-perm=true --allow-root -g npm +npm config set cache ~/.cache/npm