Skip to content

Commit 5670769

Browse files
authored
Updates nginx.dockerfile with permissions changes
Adds arguments and env conversions which pull from docker-compose.yml. Removes the pulled-in nginx.conf file and replaces it with a sed line that changes the default nginx user to the one determined by the env values. Dynamically adds group and user depending on env values, manually exiting as 0 successful (e.g. when using root or www-data users).
1 parent 027616a commit 5670769

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

nginx.dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
FROM nginx:stable-alpine
22

3-
ADD ./nginx/nginx.conf /etc/nginx/
3+
ARG NGINXGROUP
4+
ARG NGINXUSER
5+
6+
ENV NGINXGROUP=${NGINXGROUP}
7+
ENV NGINXUSER=${NGINXUSER}
8+
9+
RUN sed -i "s/user www-data/user ${NGINXUSER}/g" /etc/nginx/nginx.conf
10+
411
ADD ./nginx/default.conf /etc/nginx/conf.d/
512

613
RUN mkdir -p /var/www/html
714

8-
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
9-
10-
RUN chown laravel:laravel /var/www/html
15+
RUN addgroup -g 1000 ${NGINXGROUP} && adduser -g ${NGINXGROUP} -s /bin/sh -D ${NGINXUSER}; exit 0

0 commit comments

Comments
 (0)