Skip to content

Commit 866ffe3

Browse files
committed
Swaps user/group 1000:1000 for laravel:laravel across php/nginx containers
1 parent 04c035b commit 866ffe3

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

nginx.dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
FROM nginx:stable-alpine
22

3-
RUN addgroup -S 1000 && adduser -S 1000 -G 1000
4-
53
ADD ./nginx/nginx.conf /etc/nginx/nginx.conf
6-
ADD ./nginx/default.conf /etc/nginx/conf.d/default.conf
4+
ADD ./nginx/default.conf /etc/nginx/conf.d/default.conf
5+
6+
RUN mkdir -p /var/www/html
7+
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

nginx/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
user 1000;
1+
user laravel;
22
worker_processes auto;
33

44
error_log /var/log/nginx/error.log warn;

php.dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM php:7.4-fpm-alpine
22

3-
RUN addgroup -S 1000 && adduser -S 1000 -G 1000
4-
53
ADD ./php/www.conf /usr/local/etc/php-fpm.d/www.conf
64

5+
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
6+
7+
RUN mkdir -p /var/www/html
8+
9+
RUN chown laravel:laravel /var/www/html
10+
711
WORKDIR /var/www/html
812

913
RUN docker-php-ext-install pdo pdo_mysql

php/www.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
; Unix user/group of processes
2121
; Note: The user is mandatory. If the group is not set, the default user's group
2222
; will be used.
23-
user = 1000
24-
group = 1000
23+
user = laravel
24+
group = laravel
2525

2626
; The address on which to accept FastCGI requests.
2727
; Valid syntaxes are:

0 commit comments

Comments
 (0)