20 lines
633 B
Bash
20 lines
633 B
Bash
#!/bin/sh
|
|
set -euo pipefail
|
|
|
|
# Entrypoint for php-fpm images.
|
|
# If CHOWN_ON_START is set to '1' or 'true', recursively chown the webroot
|
|
# to the 'app' user (UID 1000). This is optional and must be explicitly enabled
|
|
# via environment (safer for multi-tenant hosts).
|
|
|
|
: ${CHOWN_ON_START:=}
|
|
if [ "${CHOWN_ON_START}" = "1" ] || [ "${CHOWN_ON_START}" = "true" ]; then
|
|
echo "[entrypoint] CHOWN_ON_START enabled — fixing ownership of /var/www/html"
|
|
# Only run chown if the directory exists
|
|
if [ -d /var/www/html ]; then
|
|
chown -R 1000:1000 /var/www/html || true
|
|
fi
|
|
fi
|
|
|
|
# Exec the given command (php-fpm by default)
|
|
exec "$@"
|