mapguesser/docker/scripts/entry-point.sh

32 lines
624 B
Bash
Executable File

#!/bin/bash
set -e
if [ -z "$USER_UID" ] or [ -z "$USER_GID" ]; then
echo "USER_UID and USER_GID should be set"
exit 1
fi
echo "Migrating DB..."
./mapg db:migrate
echo "Installing crontab..."
/usr/bin/crontab docker/scripts/cron
echo "Set runner user..."
groupadd --gid $USER_GID mapg
useradd --uid $USER_UID --gid $USER_GID mapg
chown mapg:mapg cache
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/cron -f &
/usr/sbin/php-fpm7.4 -F &
/usr/sbin/nginx -g 'daemon off;' &
sudo -u mapg -g mapg /usr/bin/node multi &
wait -n
exit $?