feat(): php8 and flarum beta.16

pull/80/head
Magicalex 2021-03-16 18:20:57 +01:00
parent e895c73167
commit abada7d0b6
No known key found for this signature in database
GPG Key ID: A89B48B1788C3CB5
12 changed files with 59 additions and 41 deletions

View File

@ -3,7 +3,7 @@ FROM alpine:3.13
LABEL description="Simple forum software for building great communities" \
maintainer="Magicalex <magicalex@mondedie.fr>, Hardware <hardware@mondedie.fr>"
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 \

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,5 @@
extension=apcu.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=7200

View File

@ -0,0 +1,5 @@
post_max_size=100M
upload_max_filesize=100M
max_execution_time=10800
max_input_time=3600
expose_php=Off

View File

@ -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

View File

@ -1,2 +1,2 @@
#!/usr/bin/env sh
exec php-fpm7
echo "crash s6"

View File

@ -1,2 +1,2 @@
#!/usr/bin/env sh
exit 0
echo "stop s6"

View File

@ -1,2 +1,3 @@
#!/usr/bin/env sh
exec nginx
/usr/sbin/nginx
s6-svscanctl -qz /etc/s6.d

3
rootfs/services/php8/run Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
/usr/sbin/php-fpm8
s6-svscanctl -qz /etc/s6.d

View File

@ -16,9 +16,9 @@ LIST_FILE=/flarum/app/extensions/list
# Set file config for nginx and php
sed -i "s/<FLARUM_PORT>/${FLARUM_PORT}/g" /etc/nginx/nginx.conf
sed -i "s/<UPLOAD_MAX_SIZE>/${UPLOAD_MAX_SIZE}/g" /etc/nginx/nginx.conf /etc/php7/php-fpm.conf
sed -i "s/<PHP_MEMORY_LIMIT>/${PHP_MEMORY_LIMIT}/g" /etc/php7/php-fpm.conf
sed -i "s/<OPCACHE_MEMORY_LIMIT>/${OPCACHE_MEMORY_LIMIT}/g" /etc/php7/conf.d/00_opcache.ini
sed -i "s/<UPLOAD_MAX_SIZE>/${UPLOAD_MAX_SIZE}/g" /etc/nginx/nginx.conf /etc/php8/php-fpm.d/www.conf
sed -i "s/<PHP_MEMORY_LIMIT>/${PHP_MEMORY_LIMIT}/g" /etc/php8/php-fpm.d/www.conf
sed -i "s/<OPCACHE_MEMORY_LIMIT>/${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}