fix: enhance user and group ID remapping logic in entrypoint script
Build and publish Docker image / build-and-push (release) Failing after 13s

This commit is contained in:
2026-07-02 16:06:46 +02:00
parent 260c8475a4
commit 186b5840a4
+8
View File
@@ -6,9 +6,17 @@ PGID=${PGID:-1001}
# Only remap if the requested IDs differ from the defaults baked into the image
if [ "$PGID" != "1001" ]; then
existing_group=$(getent group "$PGID" | cut -d: -f1)
if [ -n "$existing_group" ] && [ "$existing_group" != "nodejs" ]; then
groupdel "$existing_group"
fi
groupmod -g "$PGID" nodejs
fi
if [ "$PUID" != "1001" ]; then
existing_user=$(getent passwd "$PUID" | cut -d: -f1)
if [ -n "$existing_user" ] && [ "$existing_user" != "nextjs" ]; then
userdel "$existing_user"
fi
usermod -u "$PUID" nextjs
fi