circulartext commited on
Commit
8aefb58
·
1 Parent(s): 80ea05b

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +13 -6
entrypoint.sh CHANGED
@@ -1,12 +1,19 @@
1
  #!/bin/bash
2
 
 
 
 
3
  # Check if the user already exists
4
- if id "$USER_ID" >/dev/null 2>&1; then
5
- echo "User with ID $USER_ID already exists."
6
  else
7
- # Create the user
8
- adduser --uid "$USER_ID" --disabled-password --gecos '' appuser
9
  fi
10
 
11
- # Continue with the application startup
12
- exec "$@"
 
 
 
 
 
1
  #!/bin/bash
2
 
3
+ # Get the username from the command line arguments or use a default value
4
+ USERNAME=${1:-default_user}
5
+
6
  # Check if the user already exists
7
+ if id "$USERNAME" >/dev/null 2>&1; then
8
+ echo "User $USERNAME already exists."
9
  else
10
+ # Create the user with a home directory and a bash shell
11
+ useradd -m -s /bin/bash "$USERNAME"
12
  fi
13
 
14
+ # Set appropriate permissions for the application directory
15
+ chown -R "$USERNAME":"$USERNAME" /app
16
+
17
+ # Start your application
18
+ exec gosu "$USERNAME" uvicorn app.main:app --host 0.0.0.0 --port 7860 --reload
19
+