From 052b6cc755867f05047d7ce508c92b786bfb1edf Mon Sep 17 00:00:00 2001 From: Magicalex Date: Tue, 2 Jun 2020 18:12:38 +0200 Subject: [PATCH] feat(): add PHP_EXTENSION env to install php extension --- README.md | 21 +++++++++++++++++++++ rootfs/usr/local/bin/startup | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/README.md b/README.md index 47b96c2..b24a83f 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ | **OPCACHE_MEMORY_LIMIT** | OPcache memory size in megabytes | *optional* | 128 | **LOG_TO_STDOUT** | Enable nginx and php error logs to stdout | *optional* | false | **GITHUB_TOKEN_AUTH** | Github token to download private extensions | *optional* | false +| **PHP_EXTENSIONS** | Install additional php extensions | *optional* | none ### Required environment variable for first installation @@ -148,6 +149,26 @@ docker-compose up -d flarum ![flarum-home](http://i.imgur.com/6kH9iTV.png) +### Install additional php extensions + +```yml +version: "3" + +services: + flarum: + image: mondedie/flarum:stable + container_name: flarum + environment: + - PHP_EXTENSIONS="gmp session brotli" + volumes: + - /mnt/docker/flarum/assets:/flarum/app/public/assets + - /mnt/docker/flarum/extensions:/flarum/app/extensions + - /mnt/docker/flarum/nginx:/etc/nginx/conf.d +``` + +This example install php7-gmp php7-session and php7-brotli with apk +You can find a php extension here https://pkgs.alpinelinux.org/packages?name=php7-*&branch=v3.12&arch=x86_64 + ### Install custom extensions **Flarum extensions list :** https://flagrow.io/extensions diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup index 8125593..f0853fb 100644 --- a/rootfs/usr/local/bin/startup +++ b/rootfs/usr/local/bin/startup @@ -31,6 +31,15 @@ if [ "${LOG_TO_STDOUT}" = true ]; then sed -i "s/.*error_log.*$/error_log = \/dev\/stdout/" /etc/php7/php-fpm.conf fi +# Install additional php extensions +if [ -n "${PHP_EXTENSIONS}" ]; then + for extension in ${PHP_EXTENSIONS}; do + PACKAGES="php7-${extension} ${PACKAGES}" + done + + apk add --no-progress --no-cache ${PACKAGES} +fi + cd /flarum/app # add github token authentication (eg. for privates extensions)