Spaces:
Sleeping
Sleeping
circulartext
commited on
Commit
•
ad11504
1
Parent(s):
022c763
Update entrypoint.sh
Browse files- entrypoint.sh +6 -14
entrypoint.sh
CHANGED
@@ -1,24 +1,16 @@
|
|
1 |
-
|
|
|
|
|
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 |
-
|
13 |
useradd -m -u "$USER_ID" user
|
14 |
fi
|
15 |
|
16 |
-
#
|
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 "$@"
|
|
|
|
1 |
+
bash
|
2 |
+
Copy code
|
3 |
+
#!/bin/bash
|
4 |
set -e
|
5 |
|
|
|
|
|
|
|
|
|
6 |
# Check if the user already exists
|
7 |
if id "$USER_ID" >/dev/null 2>&1; then
|
8 |
echo "User with ID $USER_ID already exists."
|
9 |
else
|
10 |
+
# Create a new user with the specified ID
|
11 |
useradd -m -u "$USER_ID" user
|
12 |
fi
|
13 |
|
14 |
+
# Run the CMD or any other command you want to execute
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
exec "$@"
|
16 |
+
|