Skip to content

Commit

Permalink
fix: Resolve docker build failure of NodeJS application (#1017)
Browse files Browse the repository at this point in the history
Signed-off-by: Akash Nayak <akash19nayak@gmail.com>
  • Loading branch information
Akash-Nayak authored Apr 6, 2023
1 parent 205a4f5 commit 2b8fba9
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@

FROM registry.access.redhat.com/ubi8/nodejs-{{ .NodeMajorVersion }}
COPY . .
{{- if eq .PackageManager "npm" }}
USER root
RUN mkdir -p /opt/app-root/src/.npm
RUN chown -R 1001:0 /opt/app-root/src/
RUN chmod -R 775 /opt/app-root/src/
USER 1001
{{- end }}
{{- if eq .PackageManager "yarn" }}
RUN npm install --global yarn
{{- end }}
RUN {{ .PackageManager }} install
{{- if .Build }}
RUN {{ .PackageManager }} run build
{{- end}}
{{- if eq .PackageManager "npm" }}
USER root
RUN mkdir -p /opt/app-root/src/.npm
RUN chown -R 1001:0 /opt/app-root/src/.npm
RUN chmod -R 775 /opt/app-root/src/.npm
USER 1001
{{- end }}
EXPOSE {{ .Port }}
CMD {{ .PackageManager }} run start

0 comments on commit 2b8fba9

Please sign in to comment.