fix #11: added DISABLE_WEBROOT_CHOWN

This commit is contained in:
2025-07-31 15:19:37 +02:00
parent 6ec02743da
commit 092e9d552b
3 changed files with 13 additions and 3 deletions

View File

@@ -34,7 +34,8 @@ services:
FPM_MAX_CHILDREN: 5 # default: 5
FPM_START_SERVERS: 1 # default: 1
FPM_MIN_SPARE_SERVERS: 1 # default: 1
FPM_MAX_SPARE_SERVERS: 3 # default: 3
FPM_MAX_SPARE_SERVERS: 3 # default: 3
DISABLE_WEBROOT_CHOWN: 1 # default: 0
```
The `/data/www` and `/data/logs` directories and their contents will be chowned to `$PUID:$PGID` and chmodded to `0755` for directories and `0644` for files at container start.

View File

@@ -24,6 +24,8 @@ FPM_START_SERVERS=${FPM_START_SERVERS:-1}
FPM_MIN_SPARE_SERVERS=${FPM_MIN_SPARE_SERVERS:-1}
FPM_MAX_SPARE_SERVERS=${FPM_MAX_SPARE_SERVERS:-3}
DISABLE_WEBROOT_CHOWN=${DISABLE_WEBROOT_CHOWN:-0}
export USERNAME
export GROUPNAME
export PATH_BASE
@@ -46,6 +48,8 @@ export FPM_START_SERVERS
export FPM_MIN_SPARE_SERVERS
export FPM_MAX_SPARE_SERVERS
export DISABLE_WEBROOT_CHOWN
# run all scripts in order
run-parts /app/entrypoint.sh.d

View File

@@ -1,7 +1,12 @@
#!/bin/sh
echo "# chowning ${PATH_WEBROOT} to ${PUID}:${GROUPNAME}..."
echo "# Started background chowning of ${PATH_WEBROOT} to ${USERNAME}:${GROUPNAME} (${PUID}:${PGID})..."
chown "${PUID}:${GROUPNAME}" "${PATH_WEBROOT}" -R
if [ ${DISABLE_WEBROOT_CHOWN} -eq 1 ] ; then
echo chowning skipped because of DISABLE_WEBROOT_CHOWN
exit 0
fi
chown "${USERNAME}:${GROUPNAME}" "${PATH_WEBROOT}" -R
find "${PATH_WEBROOT}" -type d -exec chmod 0755 {} \; &
find "${PATH_WEBROOT}" -type f -exec chmod 0644 {} \; &