Skip to content

Commit

Permalink
Fix NPM Cache directory permission and PID Signalling bugs
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jujaga committed Nov 9, 2023
1 parent 1e23d36 commit 2e05bb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -27,4 +29,4 @@ USER 1001
RUN npm ci --omit=dev

EXPOSE ${APP_PORT}
CMD ["npm", "run", "start"]
CMD ["node", "./bin/www"]
2 changes: 1 addition & 1 deletion app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ USER 1001
RUN npm ci --omit=dev

EXPOSE ${APP_PORT}
CMD ["npm", "run", "start"]
CMD ["node", "./bin/www"]

0 comments on commit 2e05bb3

Please sign in to comment.