circulartext commited on
Commit
9e90a21
·
1 Parent(s): 7b8fd64

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +9 -6
entrypoint.sh CHANGED
@@ -1,13 +1,16 @@
1
  #!/bin/sh
 
2
 
3
- # Check if the user is root
4
  if [ "$(id -u)" = "0" ]; then
5
- # Drop privileges using gosu
6
- exec gosu user "$0" "$@"
 
 
 
 
7
  fi
8
 
9
- # Handle any pre-start tasks if needed
10
-
11
- # Run the main command
12
  exec "$@"
13
 
 
1
  #!/bin/sh
2
+ set -e
3
 
4
+ # Check if the user needs to be created
5
  if [ "$(id -u)" = "0" ]; then
6
+ if id "$USER_ID" >/dev/null 2>&1; then
7
+ echo "User with ID $USER_ID already exists."
8
+ else
9
+ useradd -m -u "$USER_ID" user
10
+ chown -R user:user /app
11
+ fi
12
  fi
13
 
14
+ # Execute the CMD or provided command
 
 
15
  exec "$@"
16