File tree 4 files changed +41
-33
lines changed
4 files changed +41
-33
lines changed Original file line number Diff line number Diff line change 1
1
FROM composer:2
2
2
3
- ARG PHPGROUP
4
- ARG PHPUSER
3
+ ENV UID=1000
4
+ ENV GID=1000
5
5
6
- ENV PHPGROUP =${PHPGROUP }
7
- ENV PHPUSER =${PHPUSER }
6
+ ARG UID =${UID }
7
+ ARG GID =${GID }
8
8
9
- RUN addgroup --system ${PHPGROUP}; exit 0
10
- RUN adduser --system -G ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; exit 0
9
+ # MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
10
+ RUN delgroup dialout
11
+
12
+ RUN addgroup -g ${GID} --system laravel
13
+ RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
11
14
12
15
WORKDIR /var/www/html
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ services:
9
9
context : .
10
10
dockerfile : nginx.dockerfile
11
11
args :
12
- - NGINXUSER =${NGINXUSER:-www-data }
13
- - NGINXGROUP =${NGINXGROUP:-www-data }
12
+ - UID =${UID:-1000 }
13
+ - GID =${GID:-1000 }
14
14
container_name : nginx
15
15
ports :
16
16
- 80:80
@@ -46,8 +46,8 @@ services:
46
46
context : .
47
47
dockerfile : php.dockerfile
48
48
args :
49
- - PHPUSER =${PHPUSER:-www-data }
50
- - PHPGROUP =${PHPGROUP:-www-data }
49
+ - UID =${UID:-1000 }
50
+ - GID =${GID:-1000 }
51
51
container_name : php
52
52
volumes :
53
53
- ./src:/var/www/html:delegated
@@ -68,15 +68,15 @@ services:
68
68
context : .
69
69
dockerfile : composer.dockerfile
70
70
args :
71
- - PHPUSER =${PHPUSER:-www-data }
72
- - PHPGROUP =${PHPGROUP:-www-data }
71
+ - UID =${UID:-1000 }
72
+ - GID =${GID:-1000 }
73
73
container_name : composer
74
74
volumes :
75
75
- ./src:/var/www/html
76
76
working_dir : /var/www/html
77
77
depends_on :
78
78
- php
79
- user : ${PHPUSER:-www-data}
79
+ user : laravel
80
80
entrypoint : ['composer', '--ignore-platform-reqs']
81
81
networks :
82
82
- laravel
@@ -99,8 +99,8 @@ services:
99
99
context : .
100
100
dockerfile : php.dockerfile
101
101
args :
102
- - PHPUSER =${PHPUSER:-www-data }
103
- - PHPGROUP =${PHPGROUP:-www-data }
102
+ - UID =${UID:-1000 }
103
+ - GID =${GID:-1000 }
104
104
container_name : artisan
105
105
volumes :
106
106
- ./src:/var/www/html:delegated
Original file line number Diff line number Diff line change 1
1
FROM nginx:stable-alpine
2
2
3
- ARG NGINXGROUP
4
- ARG NGINXUSER
3
+ ENV UID=1000
4
+ ENV GID=1000
5
5
6
- ENV NGINXGROUP =${NGINXGROUP }
7
- ENV NGINXUSER =${NGINXUSER }
6
+ ARG UID =${UID }
7
+ ARG GID =${GID }
8
8
9
- RUN sed -i "s/user www-data/user ${NGINXUSER}/g" /etc/nginx/nginx.conf
9
+ # MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
10
+ RUN delgroup dialout
10
11
11
- ADD ./nginx/default.conf /etc/nginx/conf.d/
12
+ RUN addgroup -g ${GID} --system laravel
13
+ RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
14
+ RUN sed -i "s/user nginx/user laravel/g" /etc/nginx/nginx.conf
12
15
13
- RUN mkdir -p /var/www/html
16
+ ADD ./nginx/default.conf /etc/nginx/conf.d/
14
17
15
- RUN addgroup --system ${NGINXGROUP}; exit 0
16
- RUN adduser --system -G ${NGINXGROUP} -s /bin/sh -D ${NGINXUSER}; exit 0
18
+ RUN mkdir -p /var/www/html
Original file line number Diff line number Diff line change 1
1
FROM php:8-fpm-alpine
2
2
3
- ARG PHPGROUP
4
- ARG PHPUSER
3
+ ENV UID=1000
4
+ ENV GID=1000
5
5
6
- ENV PHPGROUP=${PHPGROUP}
7
- ENV PHPUSER=${PHPUSER}
8
-
9
- RUN addgroup --system ${PHPGROUP}; exit 0
10
- RUN adduser --system -G ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; exit 0
6
+ ARG UID=${UID}
7
+ ARG GID=${GID}
11
8
12
9
RUN mkdir -p /var/www/html
13
10
14
11
WORKDIR /var/www/html
15
12
16
- RUN sed -i "s/user = www-data/user = ${PHPUSER}/g" /usr/local/etc/php-fpm.d/www.conf
17
- RUN sed -i "s/group = www-data/group = ${PHPGROUP}/g" /usr/local/etc/php-fpm.d/www.conf
13
+ # MacOS staff group's gid is 20, so is the dialout group in alpine linux. We're not using it, let's just remove it.
14
+ RUN delgroup dialout
15
+
16
+ RUN addgroup -g ${GID} --system laravel
17
+ RUN adduser -G laravel --system -D -s /bin/sh -u ${UID} laravel
18
+
19
+ RUN sed -i "s/user = www-data/user = laravel/g" /usr/local/etc/php-fpm.d/www.conf
20
+ RUN sed -i "s/group = www-data/group = laravel/g" /usr/local/etc/php-fpm.d/www.conf
18
21
RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
19
22
20
23
RUN docker-php-ext-install pdo pdo_mysql
You can’t perform that action at this time.
0 commit comments