Skip to content

Commit

Permalink
Update Dockerfile to force the nginx uid and set USER numerically
Browse files Browse the repository at this point in the history
  • Loading branch information
trnubo committed Feb 1, 2024
1 parent 3554fc8 commit b5bb718
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM alpine:3.19

ARG UID=101

# Install bash-container functions
RUN set -x \
&& BASHCONTAINER_VERSION=0.8.0 \
Expand Down Expand Up @@ -36,7 +38,9 @@ RUN set -x \
&& rm -f /tmp/* \
;

RUN apk update \
RUN set -x \
&& adduser -h /var/lib/nginx -g nginx -s /sbin/nologin -u ${UID} -D nginx \
&& apk update \
&& apk add --no-cache bash tree git nginx aws-cli \
&& cd /etc/nginx \
&& mkdir -p /run/nginx /var/www/html \
Expand All @@ -56,6 +60,7 @@ ENTRYPOINT ["/entry.sh"]
EXPOSE 8080
STOPSIGNAL SIGTERM

USER nginx
# Use the nginx user, set this numerically so Kubernetes runAsNonRoot works
USER ${UID}

CMD ["nginx"]

0 comments on commit b5bb718

Please sign in to comment.