From f6f9431b9197c88aef4be9a830daf4e33a24abda Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Tue, 12 Dec 2023 11:13:42 -0800 Subject: [PATCH] Update Node to 20.9.0 LTS and bugfix npm eacces error Signed-off-by: Jeremy Ho --- openshift/app.bc.yaml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/openshift/app.bc.yaml b/openshift/app.bc.yaml index 8a19cfea..b4a85374 100644 --- a/openshift/app.bc.yaml +++ b/openshift/app.bc.yaml @@ -43,12 +43,25 @@ objects: type: Git dockerfile: |- FROM BuildConfig - ENV NO_UPDATE_NOTIFIER=true - WORKDIR /opt/app-root/src - COPY . . - RUN npm ci - EXPOSE 3000 - CMD ["npm", "run", "start"] + + ARG APP_ROOT=/opt/app-root/src + ENV APP_PORT=3000 \ + NO_UPDATE_NOTIFIER=true + WORKDIR ${APP_ROOT} + + # NPM Permission Fix + RUN mkdir -p /.npm + RUN chown -R 1001:0 /.npm + + # Install Application + COPY . ${APP_ROOT}/app + RUN chown -R 1001:0 ${APP_ROOT} + USER 1001 + WORKDIR ${APP_ROOT}/app + RUN npm ci --omit=dev + + EXPOSE ${APP_PORT} + CMD ["node", "./bin/www"] strategy: dockerStrategy: env: @@ -58,7 +71,7 @@ objects: value: notice from: kind: DockerImage - name: docker.io/node:16.15.0-alpine + name: docker.io/node:20.9.0-alpine type: Docker successfulBuildsHistoryLimit: 3 parameters: