From 184677a651d5b85be2c57b6d87be9e79917cebb9 Mon Sep 17 00:00:00 2001 From: guru-aot Date: Mon, 8 Jan 2024 15:47:59 -0700 Subject: [PATCH] #2648 - Prod NPM Access fix (#2649) API failure in PROD due to NPM access issue image.png This is related to https://app.zenhub.com/workspaces/student-information-management-system-5fce9df5aa1b45000e937014/issues/gh/bcgov/sims/2535 So cherry picking the changes that went through as part of this ticket into the new HOTFIX branch v1.2.1 Please note: NOT upgrading NPM or changing any other apps dockerfile like workers, queue-consumers or load-test-gateway. As they are not deployed and used in PROD env. --- sources/packages/backend/apps/api/Dockerfile | 5 +++++ sources/packages/backend/apps/db-migrations/Dockerfile | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sources/packages/backend/apps/api/Dockerfile b/sources/packages/backend/apps/api/Dockerfile index 710ac17276..635b43c02c 100644 --- a/sources/packages/backend/apps/api/Dockerfile +++ b/sources/packages/backend/apps/api/Dockerfile @@ -23,5 +23,10 @@ RUN npm run build api # Exposing application port EXPOSE ${PORT} +# Grant access to group 0 to allow npm v9 to work +# See: https://docs.openshift.com/container-platform/4.11/openshift_images/create-images.html#use-uid_create-images +RUN chgrp -R 0 ./.npm && \ + chmod -R g=u ./.npm + # Entry point CMD [ "npm", "run", "start:prod:api" ] \ No newline at end of file diff --git a/sources/packages/backend/apps/db-migrations/Dockerfile b/sources/packages/backend/apps/db-migrations/Dockerfile index e215118aa5..6f1b29d8dc 100644 --- a/sources/packages/backend/apps/db-migrations/Dockerfile +++ b/sources/packages/backend/apps/db-migrations/Dockerfile @@ -15,5 +15,10 @@ COPY tsconfig.json ./ COPY tsconfig.build.json ./ COPY env-setup.js ./ +# Grant access to group 0 to allow npm v9 to work +# See: https://docs.openshift.com/container-platform/4.11/openshift_images/create-images.html#use-uid_create-images +RUN chgrp -R 0 ./.npm && \ + chmod -R g=u ./.npm + # Entry point CMD [ "npm", "run", "start:prod:db-migrations" ]