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

Commit027616a

Browse files
authored
Updates php.dockerfile with permissions changes
Adds lines to pull in docker-compose arguments to env values. Adds a dynamic addgroup and adduser line to add the user/group associated with the env values, manually returns 0 on that line to always return successful (e.g. when using user root or www-data). Adds sed lines to change the group and user associated with the php service, removes the conf file originally overwriting those. Adds CMD line to start php-fpm with the -R flag, allowing root user.
1 parent331ba93 commit027616a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎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