Skip to content

Commit

Permalink
Modified: Container runs as non-root
Browse files Browse the repository at this point in the history
Signed-off-by: Saurabhkr952 <[email protected]>
  • Loading branch information
Saurabhkr952 committed Apr 6, 2024
1 parent 3e8bf8f commit 9f8140d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ RUN npm run build

# Stage 2: Serve React.js application using Nginx
FROM nginx:stable-alpine3.17
WORKDIR /app

## add permissions for nginx user
RUN chown -R nginx:nginx /app && chmod -R 755 /app && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
COPY --from=build-stage /app/dist /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 9f8140d

Please sign in to comment.