Install only production ready dependencies.

This commit is contained in:
SamTV12345 2023-07-01 18:24:00 +02:00
parent 08c15fa4a1
commit e6bb346e6f
No known key found for this signature in database
GPG key ID: E63EEC7466038043
2 changed files with 14 additions and 7 deletions

View file

@ -60,6 +60,7 @@ ARG EP_UID=5001
ARG EP_GID=0 ARG EP_GID=0
ARG EP_SHELL= ARG EP_SHELL=
ENV NODE_ENV=production
RUN groupadd --system ${EP_GID:+--gid "${EP_GID}" --non-unique} etherpad && \ RUN groupadd --system ${EP_GID:+--gid "${EP_GID}" --non-unique} etherpad && \
useradd --system ${EP_UID:+--uid "${EP_UID}" --non-unique} --gid etherpad \ useradd --system ${EP_UID:+--uid "${EP_UID}" --non-unique} --gid etherpad \

View file

@ -36,14 +36,20 @@ if [ ! -f "$settings" ]; then
cp settings.json.template "$settings" || exit 1 cp settings.json.template "$settings" || exit 1
fi fi
log "Installing dependencies..." log "Installing dependencies..."
( (mkdir -p node_modules &&
mkdir -p node_modules && cd node_modules && ls -lisa &&
cd node_modules && { [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } &&
{ [ -d ep_etherpad-lite ] || ln -sf ../src ep_etherpad-lite; } && cd ep_etherpad-lite)
cd ep_etherpad-lite &&
npm ci --no-optional --omit=optional --include=dev --lockfile-version 1 if [[ -z NODE_ENV ]]; then
) || exit 1 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 # Remove all minified data to force node creating it new
log "Clearing minified cache..." log "Clearing minified cache..."