Skip to content

Commit fa95c5b

Browse files
committed
fix: fixed wrong permission in dockerfile
TRACEFOSS-xxx
1 parent e165f1e commit fa95c5b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=10s \
2020
CMD curl -fSs 127.0.0.1:8080/healthz || exit 1
2121

2222
USER root
23+
#Add a user with userid 8877 and name nonroot
24+
RUN addgroup -S nonrootgroup && adduser -u 8877 -D -S nonroot -G nonrootgroup
25+
2326
RUN rm /usr/share/nginx/html/index.html && rm /etc/nginx/conf.d/default.conf
2427

2528
# Copy project files from ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
2629
COPY --from=builder /ng-app/dist /usr/share/nginx/html
2730

2831
# Give ownership to nginx user over dir with content
2932

30-
RUN chown -R nginx:nginx /usr/share/nginx/html/
33+
RUN chown -R nonroot:nonrootgroup /usr/share/nginx/html/
3134
USER nginx
3235

3336
# Install Node.js from builder stage
@@ -45,8 +48,6 @@ COPY ./scripts/inject-dynamic-env.js /docker-entrypoint.d/
4548
RUN nginx -t
4649

4750
USER root
48-
#Add a user with userid 8877 and name nonroot
49-
RUN addgroup -S nonrootgroup && adduser -u 8877 -D -S nonroot -G nonrootgroup
5051

5152
#Run Container as nonroot
5253
USER nonroot

0 commit comments

Comments
 (0)