Skip to content

Commit 2eb6d95

Browse files
committed
fixing sonar root user issue
1 parent dbb509c commit 2eb6d95

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ RUN npm run build
99

1010
FROM nginx:alpine
1111

12+
RUN chown -R nginx:nginx /var/cache/nginx && \
13+
chown -R nginx:nginx /var/run && \
14+
chown -R nginx:nginx /var/log/nginx && \
15+
chown -R nginx:nginx /run
1216
# Copy the built application from the 'build' stage
1317
COPY --from=build /app/dist /usr/share/nginx/html
1418

@@ -18,7 +22,6 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
1822
# Expose the non-privileged port
1923
EXPOSE 8080
2024

21-
# Switch to the non-root user
2225
USER nginx
2326

2427
# Start nginx

0 commit comments

Comments
 (0)