Spaces:
Sleeping
Sleeping
Commit ·
ee9ae6d
1
Parent(s): b037ea8
Update entrypoint.sh
Browse files- entrypoint.sh +15 -8
entrypoint.sh
CHANGED
|
@@ -1,17 +1,24 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
set -e
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
echo "USER_ID: $USER_ID"
|
| 14 |
-
echo "USER_GROUP: $USER_GROUP"
|
| 15 |
|
| 16 |
# Execute the main command
|
| 17 |
exec "$@"
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
set -e
|
| 3 |
|
| 4 |
+
# Define the user ID in the environment variable USER_ID with a default value
|
| 5 |
+
ARG USER_ID=1000
|
| 6 |
+
ENV USER_ID=$USER_ID
|
| 7 |
|
| 8 |
+
# Check if the user already exists
|
| 9 |
+
if id "$USER_ID" >/dev/null 2>&1; then
|
| 10 |
+
echo "User with ID $USER_ID already exists."
|
| 11 |
+
else
|
| 12 |
+
echo "Creating user with ID $USER_ID."
|
| 13 |
+
useradd -m -u "$USER_ID" user
|
| 14 |
+
fi
|
| 15 |
|
| 16 |
+
# Set appropriate permissions for the application directory
|
| 17 |
+
chown -R user:user /app
|
| 18 |
+
chmod -R 755 /app
|
| 19 |
+
|
| 20 |
+
# Print environment variables for debugging
|
| 21 |
echo "USER_ID: $USER_ID"
|
|
|
|
| 22 |
|
| 23 |
# Execute the main command
|
| 24 |
exec "$@"
|