Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d3bba8

Browse files
authored
Merge pull requestaschmelyun#115 from aschmelyun/permissions-fix
Fixes known permissions issues with different OS's
2 parents7e89337 +3ee820a commit8d3bba8

File tree

7 files changed

+44
-479
lines changed

7 files changed

+44
-479
lines changed

‎.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NGINXGROUP=www-data
2+
NGINXUSER=www-data
3+
PHPGROUP=www-data
4+
PHPUSER=www-data

‎composer.dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
FROM composer:2
22

3-
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
3+
ARG PHPGROUP
4+
ARG PHPUSER
5+
6+
ENV PHPGROUP=${PHPGROUP}
7+
ENV PHPUSER=${PHPUSER}
8+
9+
RUN addgroup -g 1000 ${PHPGROUP} && adduser -g ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; exit 0
410

511
WORKDIR /var/www/html

‎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:

‎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

‎nginx/nginx.conf

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎php.dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
FROM php:7.4-fpm-alpine
22

3-
ADD ./php/www.conf /usr/local/etc/php-fpm.d/
3+
ARG PHPGROUP
4+
ARG PHPUSER
45

5-
RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel
6+
ENV PHPGROUP=${PHPGROUP}
7+
ENV PHPUSER=${PHPUSER}
68

7-
RUNmkdir -p /var/www/html
9+
RUNaddgroup -g 1000 ${PHPGROUP} && adduser -g ${PHPGROUP} -s /bin/sh -D ${PHPUSER}; exit 0
810

9-
RUNchown laravel:laravel /var/www/html
11+
RUNmkdir -p /var/www/html
1012

1113
WORKDIR /var/www/html
1214

15+
RUN sed -i"s/user = www-data/user = ${PHPUSER}/g" /usr/local/etc/php-fpm.d/www.conf
16+
RUN sed -i"s/group = www-data/group = ${PHPGROUP}/g" /usr/local/etc/php-fpm.d/www.conf
17+
1318
RUN docker-php-ext-install pdo pdo_mysql
1419

1520
RUN mkdir -p /usr/src/php/ext/redis \
1621
&& curl -L https://github.com/phpredis/phpredis/archive/5.3.4.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
1722
&& echo'redis' >> /usr/src/php-available-exts \
1823
&& docker-php-ext-install redis
24+
25+
CMD ["php-fpm","-y","/usr/local/etc/php-fpm.conf","-R"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp