Tweak: Improve ownership check and chown handling for .next dir (#5513)

This commit is contained in:
shamoon 2025-07-15 06:56:46 -07:00 committed by GitHub
parent dba3a1f893
commit d0165326a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,9 +44,15 @@ fi
if [ -d /app/.next ]; then
CURRENT_UID=$(stat -c %u /app/.next)
if [ "$CURRENT_UID" -ne "$PUID" ]; then
CURRENT_GID=$(stat -c %g /app/.next)
if [ "$PUID" -ne 0 ] && ([ "$CURRENT_UID" -ne "$PUID" ] || [ "$CURRENT_GID" -ne "$PGID" ]); then
echo "Fixing ownership of /app/.next"
chown -R "$PUID:$PGID" /app/.next || echo "Warning: Could not chown /app/.next"
if ! chown -R "$PUID:$PGID" /app/.next 2>/dev/null; then
echo "Warning: Could not chown /app/.next; continuing anyway"
fi
else
echo "/app/.next already owned by correct UID/GID or running as root, skipping chown"
fi
fi