File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,15 @@ RUN apk del --no-cache \
7676 libtool && \
7777 rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
7878
79- # Create a non-root user for security
80- RUN addgroup -S ${GROUP} && adduser -S ${USER} -G ${GROUP} && \
81- mkdir -p /var/www/html && \
82- chown -R ${USER}:${GROUP} /var/www/html
79+ # Set the working directory
80+ WORKDIR /var/www
8381
84- WORKDIR /var/www/html
82+ # Create a non-root user and group
83+ RUN getent group ${GROUP} || addgroup -g 1000 ${GROUP}
84+ RUN id -u ${USER} || adduser --shell /sbin/nologin --disabled-password --no-create-home --uid 1000 --ingroup ${GROUP} ${USER}
85+
86+ # Grant write permissions to the non-root user and group
87+ RUN chown -R ${USER}:${GROUP} /var/www
8588
8689# Expose PHP-FPM port
8790EXPOSE 9000
You can’t perform that action at this time.
0 commit comments