From e6bb346e6f91053f765ae8eecde833e5ddaee1be Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Sat, 1 Jul 2023 18:24:00 +0200 Subject: [PATCH] Install only production ready dependencies. --- Dockerfile | 1 + src/bin/installDeps.sh | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index b3ddd8299..a9da3da88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,7 @@ ARG EP_UID=5001 ARG EP_GID=0 ARG EP_SHELL= +ENV NODE_ENV=production RUN groupadd --system ${EP_GID:+--gid "${EP_GID}" --non-unique} etherpad && \ useradd --system ${EP_UID:+--uid "${EP_UID}" --non-unique} --gid etherpad \ diff --git a/src/bin/installDeps.sh b/src/bin/installDeps.sh index ed34a79c0..97828275e 100755 --- a/src/bin/installDeps.sh +++ b/src/bin/installDeps.sh @@ -36,14 +36,20 @@ if [ ! -f "$settings" ]; then cp settings.json.template "$settings" || exit 1 fi + log "Installing dependencies..." -( - mkdir -p node_modules && - cd node_modules && - { [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } && - cd ep_etherpad-lite && - npm ci --no-optional --omit=optional --include=dev --lockfile-version 1 -) || exit 1 +(mkdir -p node_modules && +cd node_modules && ls -lisa && +{ [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } && +cd ep_etherpad-lite) + +if [[ -z NODE_ENV ]]; then + cd src + npm ci --no-optional --omit=optional --include=dev --lockfile-version 1 || exit 1 +else + cd src + npm ci --no-optional --omit=optional --omit=dev --lockfile-version 1 --production || exit 1 +fi # Remove all minified data to force node creating it new log "Clearing minified cache..."