mapguesser/docker/scripts/entry-point-dev.sh
Pőcze Bence d2fa174c8f
Some checks failed
mapguesser/pipeline/pr-develop There was a failure building this commit
set runner user of web service
2023-09-26 21:50:11 +02:00

37 lines
759 B
Bash
Executable File

#!/bin/bash
set -e
echo "Installing Composer packages..."
if [ -f .env ]; then
composer install
else
composer create-project
fi
echo "Installing NPM packages..."
(cd multi && npm install)
echo "Installing Yarn packages..."
(cd public/static && yarn install)
echo "Migrating DB..."
./mapg 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 mapg
useradd --uid $USER_UID --gid $USER_GID mapg
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
set +e
/usr/sbin/php-fpm7.4 -F &
/usr/sbin/nginx -g 'daemon off;' &
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
wait -n
exit $?