18 lines
457 B
Bash
Executable File
18 lines
457 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Check if we are running as root (default)
|
|
if [ "$(id -u)" = "0" ]; then
|
|
# If /data is a directory, change its ownership to the container user
|
|
if [ -d "/data" ]; then
|
|
echo "Setting ownership of /data to appuser:appgroup"
|
|
chown -R appuser:appgroup /data
|
|
fi
|
|
|
|
# Drop privileges and run the command using gosu
|
|
exec gosu appuser "$@"
|
|
else
|
|
# If not root, just run the command directly
|
|
exec "$@"
|
|
fi
|