From abada7d0b645b644087f1edb455881a23a17fbf8 Mon Sep 17 00:00:00 2001 From: Magicalex Date: Tue, 16 Mar 2021 18:20:57 +0100 Subject: [PATCH] feat(): php8 and flarum beta.16 --- Dockerfile | 52 +++++++++---------- README.md | 6 +-- rootfs/etc/nginx/nginx.conf | 6 +-- .../etc/{php7 => php8}/conf.d/00_opcache.ini | 0 rootfs/etc/php8/conf.d/apcu.ini | 5 ++ rootfs/etc/php8/conf.d/www.ini | 5 ++ .../php-fpm.conf => php8/php-fpm.d/www.conf} | 6 ++- rootfs/services/{php/run => .s6-svscan/crash} | 2 +- rootfs/services/.s6-svscan/finish | 2 +- rootfs/services/nginx/run | 3 +- rootfs/services/php8/run | 3 ++ rootfs/usr/local/bin/startup | 10 ++-- 12 files changed, 59 insertions(+), 41 deletions(-) rename rootfs/etc/{php7 => php8}/conf.d/00_opcache.ini (100%) create mode 100644 rootfs/etc/php8/conf.d/apcu.ini create mode 100644 rootfs/etc/php8/conf.d/www.ini rename rootfs/etc/{php7/php-fpm.conf => php8/php-fpm.d/www.conf} (78%) rename rootfs/services/{php/run => .s6-svscan/crash} (52%) create mode 100644 rootfs/services/php8/run diff --git a/Dockerfile b/Dockerfile index b193d81..888f5b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:3.13 LABEL description="Simple forum software for building great communities" \ maintainer="Magicalex , Hardware " -ARG VERSION=v0.1.0-beta.15 +ARG VERSION=v0.1.0-beta.16 ENV GID=991 \ UID=991 \ @@ -25,35 +25,35 @@ RUN apk add --no-progress --no-cache \ git \ libcap \ nginx \ - php7 \ - php7-ctype \ - php7-curl \ - php7-dom \ - php7-exif \ - php7-fileinfo \ - php7-fpm \ - php7-gd \ - php7-gmp \ - php7-iconv \ - php7-intl \ - php7-json \ - php7-mbstring \ - php7-mysqlnd \ - php7-opcache \ - php7-openssl \ - php7-pdo \ - php7-pdo_mysql \ - php7-phar \ - php7-session \ - php7-tokenizer \ - php7-xmlwriter \ - php7-zip \ - php7-zlib \ + php8 \ + php8-ctype \ + php8-curl \ + php8-dom \ + php8-exif \ + php8-fileinfo \ + php8-fpm \ + php8-gd \ + php8-gmp \ + php8-iconv \ + php8-intl \ + php8-mbstring \ + php8-mysqlnd \ + php8-opcache \ + php8-pecl-apcu \ + php8-openssl \ + php8-pdo \ + php8-pdo_mysql \ + php8-phar \ + php8-session \ + php8-tokenizer \ + php8-xmlwriter \ + php8-zip \ + php8-zlib \ su-exec \ s6 \ && cd /tmp \ && curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ - && sed -i 's/memory_limit = .*/memory_limit = ${PHP_MEMORY_LIMIT}/' /etc/php7/php.ini \ + && sed -i 's/memory_limit = .*/memory_limit = ${PHP_MEMORY_LIMIT}/' /etc/php8/php.ini \ && chmod +x /usr/local/bin/composer \ && mkdir -p /flarum/app \ && COMPOSER_CACHE_DIR="/tmp" composer create-project --stability=beta --no-progress -- flarum/flarum /flarum/app $VERSION \ diff --git a/README.md b/README.md index 1111eaf..85fadc3 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ - Multi-platform image: `linux/386`, `linux/amd64`, `linux/arm/v6`, `linux/arm/v7`, `linux/arm64` - Lightweight & secure image - Based on Alpine Linux 3.13 -- **nginx** and **PHP 7.4** -- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.15) +- **nginx** and **PHP 8.0** +- Latest [Flarum Core](https://github.com/flarum/core) (v0.1.0-beta.16) - MySQL/Mariadb driver - OPCache extension configured ### Build-time variables -- **VERSION** = Version of [flarum/flarum](https://github.com/flarum/flarum) skeleton (default: *v0.1.0-beta.15*) +- **VERSION** = Version of [flarum/flarum](https://github.com/flarum/flarum) skeleton (default: *v0.1.0-beta.16*) ### Ports diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf index a67b0af..86a871a 100644 --- a/rootfs/etc/nginx/nginx.conf +++ b/rootfs/etc/nginx/nginx.conf @@ -43,12 +43,12 @@ http { # PHP Backend # -------------------------------------- - location ~* \.php$ { + location ~ \.php$ { try_files $uri =404; - include fastcgi_params; + include /etc/nginx/fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_index index.php; - fastcgi_pass unix:/tmp/php-fpm.sock; + fastcgi_pass unix:/run/php/php8-fpm.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; diff --git a/rootfs/etc/php7/conf.d/00_opcache.ini b/rootfs/etc/php8/conf.d/00_opcache.ini similarity index 100% rename from rootfs/etc/php7/conf.d/00_opcache.ini rename to rootfs/etc/php8/conf.d/00_opcache.ini diff --git a/rootfs/etc/php8/conf.d/apcu.ini b/rootfs/etc/php8/conf.d/apcu.ini new file mode 100644 index 0000000..9d476ad --- /dev/null +++ b/rootfs/etc/php8/conf.d/apcu.ini @@ -0,0 +1,5 @@ +extension=apcu.so + +apc.enabled=1 +apc.shm_size=128M +apc.ttl=7200 diff --git a/rootfs/etc/php8/conf.d/www.ini b/rootfs/etc/php8/conf.d/www.ini new file mode 100644 index 0000000..d050c5b --- /dev/null +++ b/rootfs/etc/php8/conf.d/www.ini @@ -0,0 +1,5 @@ +post_max_size=100M +upload_max_filesize=100M +max_execution_time=10800 +max_input_time=3600 +expose_php=Off diff --git a/rootfs/etc/php7/php-fpm.conf b/rootfs/etc/php8/php-fpm.d/www.conf similarity index 78% rename from rootfs/etc/php7/php-fpm.conf rename to rootfs/etc/php8/php-fpm.d/www.conf index 00f1a67..ba08681 100644 --- a/rootfs/etc/php7/php-fpm.conf +++ b/rootfs/etc/php8/php-fpm.d/www.conf @@ -1,9 +1,13 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + [global] daemonize = no error_log = /tmp/php_error.log [www] -listen = /tmp/php-fpm.sock +listen = /run/php/php8-fpm.sock pm = ondemand pm.max_children = 30 pm.process_idle_timeout = 10s diff --git a/rootfs/services/php/run b/rootfs/services/.s6-svscan/crash similarity index 52% rename from rootfs/services/php/run rename to rootfs/services/.s6-svscan/crash index e59a2b3..a677aa9 100644 --- a/rootfs/services/php/run +++ b/rootfs/services/.s6-svscan/crash @@ -1,2 +1,2 @@ #!/usr/bin/env sh -exec php-fpm7 +echo "crash s6" diff --git a/rootfs/services/.s6-svscan/finish b/rootfs/services/.s6-svscan/finish index ec5b9e5..8c7cafb 100644 --- a/rootfs/services/.s6-svscan/finish +++ b/rootfs/services/.s6-svscan/finish @@ -1,2 +1,2 @@ #!/usr/bin/env sh -exit 0 +echo "stop s6" diff --git a/rootfs/services/nginx/run b/rootfs/services/nginx/run index 0c5d17a..9022f69 100644 --- a/rootfs/services/nginx/run +++ b/rootfs/services/nginx/run @@ -1,2 +1,3 @@ #!/usr/bin/env sh -exec nginx +/usr/sbin/nginx +s6-svscanctl -qz /etc/s6.d diff --git a/rootfs/services/php8/run b/rootfs/services/php8/run new file mode 100644 index 0000000..26aac37 --- /dev/null +++ b/rootfs/services/php8/run @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +/usr/sbin/php-fpm8 +s6-svscanctl -qz /etc/s6.d diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup index 8714688..c86dc8c 100644 --- a/rootfs/usr/local/bin/startup +++ b/rootfs/usr/local/bin/startup @@ -16,9 +16,9 @@ LIST_FILE=/flarum/app/extensions/list # Set file config for nginx and php sed -i "s//${FLARUM_PORT}/g" /etc/nginx/nginx.conf -sed -i "s//${UPLOAD_MAX_SIZE}/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf -sed -i "s//${PHP_MEMORY_LIMIT}/g" /etc/php7/php-fpm.conf -sed -i "s//${OPCACHE_MEMORY_LIMIT}/g" /etc/php7/conf.d/00_opcache.ini +sed -i "s//${UPLOAD_MAX_SIZE}/g" /etc/nginx/nginx.conf /etc/php8/php-fpm.d/www.conf +sed -i "s//${PHP_MEMORY_LIMIT}/g" /etc/php8/php-fpm.d/www.conf +sed -i "s//${OPCACHE_MEMORY_LIMIT}/g" /etc/php8/conf.d/00_opcache.ini # Set permissions for /flarum folder echo "[INFO] Setting folder permissions" @@ -35,13 +35,13 @@ if [ "${LOG_TO_STDOUT}" = true ]; then echo "[INFO] Logging to stdout activated" chmod o+w /dev/stdout sed -i "s/.*error_log.*$/error_log \/dev\/stdout warn;/" /etc/nginx/nginx.conf - sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php7/php-fpm.conf + sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php8/php-fpm.d/www.conf fi # Install additional php extensions if [ -n "${PHP_EXTENSIONS}" ]; then for php_extension in ${PHP_EXTENSIONS}; do - PACKAGES="php7-${php_extension} ${PACKAGES}" + PACKAGES="php8-${php_extension} ${PACKAGES}" done echo "[INFO] Adding php extensions" apk add --no-progress --no-cache ${PACKAGES}