mapguesser/docker/scripts/entry-point-dev.sh

41 lines
832 B
Bash
Raw Normal View History

2023-09-16 19:36:42 +02:00
#!/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
2023-09-26 21:39:49 +02:00
echo "Set runner user based on owner of .env..."
if ! getent group mapg; then
USER_GID=$(stat -c "%g" .env)
groupadd --gid $USER_GID mapg
fi
if ! id -u mapg; then
USER_UID=$(stat -c "%u" .env)
useradd --uid $USER_UID --gid $USER_GID mapg
fi
2023-09-27 21:26:17 +02:00
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/8.1/fpm/pool.d/www.conf
2023-09-26 21:39:49 +02:00
2023-09-16 19:36:42 +02:00
set +e
2023-09-27 21:26:17 +02:00
/usr/sbin/php-fpm8.1 -F &
2023-09-16 19:36:42 +02:00
/usr/sbin/nginx -g 'daemon off;' &
2023-09-26 21:39:49 +02:00
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
2023-09-16 19:36:42 +02:00
wait -n
exit $?