Docker user fix
This commit is contained in:
23
backend/entrypoint.sh
Normal file
23
backend/entrypoint.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Default values
|
||||
PUID=${PUID:-1000}
|
||||
PGID=${PGID:-1000}
|
||||
|
||||
# Create group if it doesn't exist
|
||||
if ! getent group $PGID > /dev/null; then
|
||||
addgroup --gid $PGID appuser 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Create user if it doesn't exist
|
||||
if ! getent passwd $PUID > /dev/null; then
|
||||
useradd -u $PUID -g $PGID -m -s /bin/bash appuser 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Set ownership of app directory
|
||||
mkdir -p /app/data
|
||||
chown -R $PUID:$PGID /app
|
||||
|
||||
# Run command as the created user
|
||||
exec gosu $PUID:$PGID python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
Reference in New Issue
Block a user