Fix Docker segfault
This commit is contained in:
parent
d9158437e9
commit
a43e1c29fe
2 changed files with 24 additions and 20 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# Runtime UID/GID Configuration
|
||||
|
|
@ -32,15 +32,15 @@ set_db_file_permissions() {
|
|||
if [ "$CURRENT_UID" != "$PUID" ] || [ "$CURRENT_GID" != "$PGID" ]; then
|
||||
echo "Configuring user permissions..."
|
||||
|
||||
deluser app 2>/dev/null || true
|
||||
delgroup app 2>/dev/null || true
|
||||
userdel app 2>/dev/null || true
|
||||
groupdel app 2>/dev/null || true
|
||||
|
||||
if getent group "$PGID" >/dev/null 2>&1; then
|
||||
TARGET_GROUP=$(getent group "$PGID" | cut -d: -f1)
|
||||
echo "Using existing group '$TARGET_GROUP' with GUID $PGID"
|
||||
else
|
||||
# Create group "app" with our target group id
|
||||
addgroup -g "$PGID" -S app
|
||||
groupadd -g "$PGID" app
|
||||
TARGET_GROUP="app"
|
||||
echo "Created 'app' group with GID: $PGID"
|
||||
fi
|
||||
|
|
@ -50,7 +50,7 @@ if [ "$CURRENT_UID" != "$PUID" ] || [ "$CURRENT_GID" != "$PGID" ]; then
|
|||
echo "Using existing user '$TARGET_USER' with UID $PUID"
|
||||
else
|
||||
# Create user "app" with our target user id
|
||||
adduser -S app -u "$PUID" -G "$TARGET_GROUP"
|
||||
useradd -m -u "$PUID" -g "$TARGET_GROUP" app
|
||||
echo "Created 'app' user with UID: $PUID"
|
||||
TARGET_USER=app
|
||||
fi
|
||||
|
|
@ -69,4 +69,4 @@ set_db_file_permissions
|
|||
|
||||
# Drop privileges and execute the original start script
|
||||
echo "Starting application as user $TARGET_USER"
|
||||
exec su-exec "$TARGET_USER" dumb-init -- /app/backend/cmd/start.sh
|
||||
exec gosu "$TARGET_USER" dumb-init -- /app/backend/cmd/start.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue