Skip to content

Commit

Permalink
refactor: fix sonar complaints about dockerfile
Browse files Browse the repository at this point in the history
Sonar was complaining that the multiple RUN commands should be combined. Good point!
  • Loading branch information
WalterMoar committed Feb 5, 2025
1 parent bd519c1 commit d6ba595
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ FROM docker.io/node:20.18.2-alpine3.21
ENV NO_UPDATE_NOTIFIER=true
WORKDIR /opt/app-root/src/app
COPY . /opt/app-root/src

# Run the npm tasks to set up the various parts of the application. Then create
# the /.npm directory and 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 npm run all:ci \
&& npm run all:build \
&& npm run frontend:purge \
&& npm run components:clean \
&& npm run components:purge
&& npm run components:purge \
&& mkdir /.npm \
&& chgrp -R 0 /.npm \
&& chmod -R g=u /.npm

EXPOSE 8000
# Create the /.npm directory and 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 mkdir /.npm
RUN chgrp -R 0 /.npm && \
chmod -R g=u /.npm

CMD ["npm", "run", "start"]

0 comments on commit d6ba595

Please sign in to comment.