PUID/PGID changes

This commit is contained in:
Ryan
2025-04-22 08:19:10 -04:00
committed by GitHub
parent 6ff4aa5f34
commit ca3e2f316c
2 changed files with 10 additions and 2 deletions

View File

@@ -66,8 +66,15 @@ RUN apt-get update && \
# Remap www-data to the PUID/PGID provided
RUN set -eux; \
if [ "$(id -u www-data)" != "${PUID}" ]; then usermod -u "${PUID}" www-data; fi; \
if [ "$(id -g www-data)" != "${PGID}" ]; then groupmod -g "${PGID}" www-data; fi; \
# only change the UID if its not already correct
if [ "$(id -u www-data)" != "${PUID}" ]; then \
usermod -u "${PUID}" www-data; \
fi; \
# attempt to change the GID, but ignore “already exists” errors
if [ "$(id -g www-data)" != "${PGID}" ]; then \
groupmod -g "${PGID}" www-data 2>/dev/null || true; \
fi; \
# finally set www-datas primary group to PGID (will succeed if the group exists)
usermod -g "${PGID}" www-data
# Copy application tuning and code