Skip to content

Commit 331ba93

Browse files
authored
Updates docker-compose.yml with build arguments
Adds code that passes in build args (and a user on the Composer container), which will be used to determine file/directory ownership when building the source images for the containers.
1 parent 7e89337 commit 331ba93

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docker-compose.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ services:
88
build:
99
context: .
1010
dockerfile: nginx.dockerfile
11+
args:
12+
- NGINXUSER=${NGINXUSER:-www-data}
13+
- NGINXGROUP=${NGINXGROUP:-www-data}
1114
container_name: nginx
1215
ports:
1316
- 80:80
@@ -42,6 +45,9 @@ services:
4245
build:
4346
context: .
4447
dockerfile: php.dockerfile
48+
args:
49+
- PHPUSER=${PHPUSER:-www-data}
50+
- PHPGROUP=${PHPGROUP:-www-data}
4551
container_name: php
4652
volumes:
4753
- ./src:/var/www/html:delegated
@@ -61,13 +67,16 @@ services:
6167
build:
6268
context: .
6369
dockerfile: composer.dockerfile
70+
args:
71+
- PHPUSER=${PHPUSER:-www-data}
72+
- PHPGROUP=${PHPGROUP:-www-data}
6473
container_name: composer
6574
volumes:
6675
- ./src:/var/www/html
6776
working_dir: /var/www/html
6877
depends_on:
6978
- php
70-
user: laravel
79+
user: ${PHPUSER:-www-data}
7180
entrypoint: ['composer', '--ignore-platform-reqs']
7281
networks:
7382
- laravel
@@ -89,12 +98,14 @@ services:
8998
build:
9099
context: .
91100
dockerfile: php.dockerfile
101+
args:
102+
- PHPUSER=${PHPUSER:-www-data}
103+
- PHPGROUP=${PHPGROUP:-www-data}
92104
container_name: artisan
93105
volumes:
94106
- ./src:/var/www/html:delegated
95107
depends_on:
96108
- mysql
97-
user: laravel
98109
working_dir: /var/www/html
99110
entrypoint: ['php', '/var/www/html/artisan']
100111
networks:

0 commit comments

Comments
 (0)