diff --git a/docker/scripts/entry-point-dev.sh b/docker/scripts/entry-point-dev.sh index 2b1d6a5..de9f63b 100755 --- a/docker/scripts/entry-point-dev.sh +++ b/docker/scripts/entry-point-dev.sh @@ -16,10 +16,14 @@ echo "Migrating DB..." ./rvr db:migrate echo "Set runner user based on owner of .env..." -USER_UID=$(stat -c "%u" .env) -USER_GID=$(stat -c "%g" .env) -groupadd --gid $USER_GID rvr -useradd --uid $USER_UID --gid $USER_GID rvr +if ! getent group rvr; then + USER_GID=$(stat -c "%g" .env) + groupadd --gid $USER_GID rvr +fi +if ! id -u rvr; then + USER_UID=$(stat -c "%u" .env) + useradd --uid $USER_UID --gid $USER_GID rvr +fi sed -i -e "s/^user = .*$/user = rvr/g" -e "s/^group = .*$/group = rvr/g" /etc/php/8.1/fpm/pool.d/www.conf set +e diff --git a/docker/scripts/entry-point.sh b/docker/scripts/entry-point.sh index 62ef125..db207e5 100755 --- a/docker/scripts/entry-point.sh +++ b/docker/scripts/entry-point.sh @@ -9,10 +9,14 @@ echo "Installing crontab..." /usr/bin/crontab docker/scripts/cron echo "Set runner user based on owner of .env..." -USER_UID=$(stat -c "%u" .env) -USER_GID=$(stat -c "%g" .env) -groupadd --gid $USER_GID rvr -useradd --uid $USER_UID --gid $USER_GID rvr +if ! getent group rvr; then + USER_GID=$(stat -c "%g" .env) + groupadd --gid $USER_GID rvr +fi +if ! id -u rvr; then + USER_UID=$(stat -c "%u" .env) + useradd --uid $USER_UID --gid $USER_GID rvr +fi chown -R rvr:rvr cache sed -i -e "s/^user = .*$/user = rvr/g" -e "s/^group = .*$/group = rvr/g" /etc/php/8.1/fpm/pool.d/www.conf