From 2e05bb3226405e52c956e6a4cbf23a8429fe48c0 Mon Sep 17 00:00:00 2001 From: Jeremy Ho Date: Wed, 8 Nov 2023 09:16:41 -0800 Subject: [PATCH] Fix NPM Cache directory permission and PID Signalling bugs NPM appears to not propagate the SIGTERM signal to the child node app on alpine. This is fixed by unwrapping the call and starting the app directly instead. NPM cache directory permission issues have appeared again for some external reason, so we need to mitigate by explicitly forcing a permission update on the cache directory to be owned by a non-root user. Signed-off-by: Jeremy Ho --- Dockerfile | 6 ++++-- app/Dockerfile | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 587ca86..8c07b7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,9 @@ RUN wget https://www2.gov.bc.ca/assets/gov/british-columbians-our-governments/se rm -rf ./BcSansFont_Print && \ fc-cache -f -# NPM Permission Fix (already present in base image) +# NPM Permission Fix +RUN mkdir -p /.npm +RUN chown -R 1001:0 /.npm # Install Application COPY app ${APP_ROOT} @@ -27,4 +29,4 @@ USER 1001 RUN npm ci --omit=dev EXPOSE ${APP_PORT} -CMD ["npm", "run", "start"] +CMD ["node", "./bin/www"] diff --git a/app/Dockerfile b/app/Dockerfile index ae78c78..4709c10 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -27,4 +27,4 @@ USER 1001 RUN npm ci --omit=dev EXPOSE ${APP_PORT} -CMD ["npm", "run", "start"] +CMD ["node", "./bin/www"]