From 5ca0ac8f741b1e5cc7bf951e9ef657e62ad8fb88 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Mon, 28 Aug 2023 14:22:30 +0100 Subject: [PATCH] entrypoint: enable configuring PHP memory limit Adds an environment variable, PHP_MEMORY_LIMIT, which overrides the default memory limit as shipped by PHP. Closes https://github.com/wallabag/docker/issues/124 --- root/entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/root/entrypoint.sh b/root/entrypoint.sh index 5aadb12..4cbcfdd 100755 --- a/root/entrypoint.sh +++ b/root/entrypoint.sh @@ -24,9 +24,16 @@ provisioner() { SYMFONY__ENV__DATABASE_DRIVER=${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite} POPULATE_DATABASE=${POPULATE_DATABASE:-True} + # PHP configuration base and memory limit (default is 128M because that's what php.ini currently ships with) + PHP_CONF_BASE_DIR=`php --ini | head -n1 | sed 's/^.*: //'` + PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-128M} + # Replace environment variables envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml + # Configure PHP memory limit + sed -i "s/memory_limit\s*=.*/memory_limit=${PHP_MEMORY_LIMIT}/g" $PHP_CONF_BASE_DIR/php.ini + # Wait for external database if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] || [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] ; then wait_for_database