Skip to content

Commit

Permalink
Run Dashboard container as non-root user
Browse files Browse the repository at this point in the history
Add 'nginx' user to Dashboard container to avoid running container as
root user.

Running containers with 'root' user can lead to a container escape
situation. It is a best practice to run containers as non-root users.
  • Loading branch information
sbreker committed May 6, 2024
1 parent 06f0c78 commit 4716ebc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ CMD npm run dev
FROM nginx:alpine
RUN apk add --no-cache bash

ARG USER_ID=1000
ARG GROUP_ID=1000
RUN addgroup -g ${GROUP_ID} -S nginx
RUN adduser -u ${USER_ID} -S -D nginx nginx
USER nginx

RUN chown -R nginx:nginx /var/cache/nginx /var/run /usr/share/nginx/html

ARG VERSION_PATH
ARG VERSION_LONG
ARG VERSION_SHORT
Expand Down

0 comments on commit 4716ebc

Please sign in to comment.