Skip to content

Commit

Permalink
Merge pull request #395 from perftools/nginx-inline-drop-volume
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Dec 22, 2020
2 parents 46be624 + d94c2fa commit 4b502b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ RUN strip *.so && chmod a+rx *.so
FROM base AS php
RUN set -x \
&& apk add --no-cache \
nginx \
php-cli \
php-ctype \
php-fpm \
Expand All @@ -35,28 +36,31 @@ RUN set -x \
php-pdo_mysql \
php-pdo_pgsql \
php-pdo_sqlite \
&& ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm \
# Use www-data uid/gid from alpine also present in docker php images
&& addgroup -g 82 -S www-data \
# Use www-data uid from alpine also present in docker php images
&& adduser -u 82 -D -S -G www-data www-data \
# Tweak php-fpm config
&& sed -i \
-e "s#^;daemonize\s*=\s*yes#daemonize = no#" \
-e "s#^error_log\s*=.*#error_log = /var/log/php/fpm.error.log#" \
-e "s#^;error_log\s*=.*#error_log = /var/log/php/fpm.error.log#" \
$PHP_INI_DIR/php-fpm.conf \
&& POOL_CONFIG=$PHP_INI_DIR/php-fpm.d/www.conf \
&& sed -i \
-e "s#^listen\s*=.*#listen = [::]:9000#" \
-e "s#^listen\.allowed_clients\s*=.*#;&#" \
-e "s#^;access\.log\s*=.*#access.log = /var/log/php/fpm.access.log#" \
-e "s#^;clear_env\s*=.*#clear_env = no#" \
-e "s#^user = nobody\s*=.*#user = www-data#" \
-e "s#^group = nobody\s*=.*#group = www-data#" \
-e "s#^user = nobody\s*#user = www-data#" \
-e "s#^group = nobody\s*#group = www-data#" \
-e "s#^;catch_workers_output\s*=.*#catch_workers_output = yes#" \
$POOL_CONFIG \
&& rm -rf /var/log/php7 \
&& ln -s php /var/log/php7 \
&& install -d -o www-data -g www-data /var/log/php \
&& ln -sf /proc/self/fd/2 /var/log/php/fpm.access.log \
&& ln -sf /proc/self/fd/2 /var/log/php/fpm.error.log \
&& ln -s php-fpm7 /usr/sbin/php-fpm \
&& ln -s /dev/stderr /var/log/php/fpm.access.log \
&& ln -s /dev/stderr /var/log/php/fpm.error.log \
&& ln -s /dev/stdout /var/log/nginx/access.log \
&& ln -s /dev/stderr /var/log/nginx/error.log \
&& php -m

# prepare sources
Expand Down Expand Up @@ -104,8 +108,9 @@ ARG APPDIR=/var/www/xhgui
ARG WEBROOT=$APPDIR/webroot
WORKDIR $APPDIR

EXPOSE 9000
CMD ["php-fpm", "-F"]
EXPOSE 80
CMD ["sh", "-c", "nginx && exec php-fpm"]
VOLUME "/run/nginx"

COPY --from=stage-ext-mongodb /build /
COPY --from=build --chown=www-data /cache ./cache/
Expand Down
8 changes: 1 addition & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ services:
xhgui:
image: xhgui/xhgui:0.17.1
volumes:
- webroot-share:/var/www/xhgui/webroot
- ./config:/var/www/xhgui/config
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
environment:
- XHGUI_MONGO_HOSTNAME=mongo
- XHGUI_MONGO_DATABASE=xhprof

web:
image: nginx:1-alpine
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- webroot-share:/var/www/xhgui/webroot
ports:
- "8142:80"

Expand Down

0 comments on commit 4b502b1

Please sign in to comment.