Skip to content

Commit a6b28f6

Browse files
committed
build(openresty): use non-root user
1 parent 57e8d54 commit a6b28f6

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

openid-connect-provider-debugger/Dockerfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# checkov:skip=CKV_DOCKER_3: [Missing USER]: inherited from parent image
2-
# trivy:ignore:AVD-DS-0002: [Missing USER]: inherited from parent image
31
FROM openresty/openresty:1.27.1.2-4-alpine-fat@sha256:e93c5ab42fb6c7a882418c2bad0b39b566759f88c3fdd62f97264b621b6cba80
42

53
ARG LUA_RESTY_OPENIDC_VERSION="1.8.0-1"
4+
ARG USER_NAME=openresty
5+
ARG USER_HOME=/home/openresty
6+
ARG USER_ID=1000
7+
ARG USER_GECOS=OpenResty
68

79
SHELL ["/bin/ash", "-euo", "pipefail", "-c"]
810

@@ -31,4 +33,18 @@ COPY default.conf /etc/nginx/conf.d/
3133

3234
COPY index.html error.html /usr/local/openresty/nginx/html/
3335

36+
RUN adduser \
37+
--home "${USER_HOME}" \
38+
--uid "${USER_ID}" \
39+
--gecos "${USER_GECOS}" \
40+
--disabled-password \
41+
"${USER_NAME}" \
42+
chown -R "${USER_NAME}:${USER_NAME}" /var/run/openresty /usr/local/openresty/nginx/logs
43+
44+
USER "${USER_NAME}"
45+
46+
ENV HOME="${USER_HOME}"
47+
48+
WORKDIR "${HOME}"
49+
3450
EXPOSE 80 443

0 commit comments

Comments
 (0)