File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff 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
2222USER 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+
2326RUN 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
2629COPY --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/
3134USER nginx
3235
3336# Install Node.js from builder stage
@@ -45,8 +48,6 @@ COPY ./scripts/inject-dynamic-env.js /docker-entrypoint.d/
4548RUN nginx -t
4649
4750USER 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
5253USER nonroot
You can’t perform that action at this time.
0 commit comments