Spaces:
Sleeping
Sleeping
File size: 548 Bytes
3068f36 6bb32f9 ee9ae6d 7d78cfc ee9ae6d 7d78cfc ee9ae6d 7d78cfc ee344eb 7d78cfc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#!/bin/sh
set -e
# Define the user ID in the environment variable USER_ID with a default value
ARG USER_ID=1000
ENV USER_ID=$USER_ID
# Check if the user already exists
if id "$USER_ID" >/dev/null 2>&1; then
echo "User with ID $USER_ID already exists."
else
echo "Creating user with ID $USER_ID."
useradd -m -u "$USER_ID" user
fi
# Set appropriate permissions for the application directory
chown -R user:user /app
chmod -R 755 /app
# Print environment variables for debugging
echo "USER_ID: $USER_ID"
# Execute the main command
exec "$@"
|