Spaces:
Sleeping
Sleeping
# Get the username from the command line arguments | |
USERNAME=$1 | |
# Check if the username is empty | |
if [ -z "$USERNAME" ]; then | |
echo "No username provided. Exiting..." | |
exit 1 | |
fi | |
# Check if the user already exists | |
if id "$USERNAME" >/dev/null 2>&1; then | |
echo "User $USERNAME already exists." | |
else | |
# Create the user with a home directory and a bash shell | |
useradd -m -s /bin/bash "$USERNAME" | |
fi | |
# Set appropriate permissions for the application directory | |
chown -R "$USERNAME":"$USERNAME" /app | |
# Start your application | |
exec gosu "$USERNAME" uvicorn app.main:app --host 0.0.0.0 --port 7860 --reload | |