Changed classical docker image in the way that we do not need to passthrough env vars explicitly

This commit is contained in:
Jan Böhmer 2025-08-30 21:40:24 +02:00
parent d45cd23c0f
commit 9a8e34cbe3
3 changed files with 23 additions and 32 deletions

View file

@ -20,6 +20,25 @@
set -e
# Pass all environment variables to PHP-FPM
# Path where PHP-FPM pool configs live
PHP_FPM_ENV_CONF="/etc/php/PHP_VERSION/fpm/pool.d/99-env.conf"
# start fresh
echo "; auto-generated env config" > "$PHP_FPM_ENV_CONF"
echo "[www]" >> "$PHP_FPM_ENV_CONF"
echo "clear_env = no" >> "$PHP_FPM_ENV_CONF"
# add all container envs
printenv | while IFS='=' read -r name value; do
case "$name" in
HOSTNAME|PWD|SHLVL|PATH|_*) continue ;;
esac
# write literal value in quotes
echo "env[$name] = \"$value\"" >> "$PHP_FPM_ENV_CONF"
done
# recursive chowns can take a while, so we'll just do it if the owner is wrong
# Chown uploads/ folder if it does not belong to www-data
@ -90,4 +109,4 @@ if [ "${1#-}" != "$1" ]; then
fi
# Pass to the original entrypoint
exec "$@"
exec "$@"