2FAuth/docker/entrypoint.sh

45 lines
956 B
Bash
Raw Normal View History

2021-07-29 23:44:30 +02:00
#!/bin/bash
2021-07-29 23:52:34 +02:00
cleanup() {
set +e
echo "Stopping php7.3-fpm service..."
sudo service php7.3-fpm stop
}
trap cleanup 0
2021-07-29 23:52:11 +02:00
set -e
2021-07-29 23:44:30 +02:00
if [ "${DB_CONNECTION}" = "sqlite" ]; then
2021-07-31 15:43:00 +02:00
if [ ! -f /2fauth/database.sqlite ]; then
touch /2fauth/database.sqlite
2021-07-29 23:44:30 +02:00
fi
2021-07-31 15:43:00 +02:00
rm -f /srv/database/database.sqlite
ln -sF /2fauth/database.sqlite /srv/database/database.sqlite
2021-07-29 23:44:30 +02:00
fi
2021-07-31 15:51:44 +02:00
# Inject storage in /2fauth and use it with a symlink
if [ ! -d /2fauth/storage ]; then
mv /srv/storage /2fauth/storage
else
rm -r /srv/storage
fi
ln -sF /2fauth/storage /srv/storage
2021-07-29 23:44:30 +02:00
sudo service php7.3-fpm start
sudo service php7.3-fpm status
if [ -f /2fauth/installed ]; then
php artisan migrate
php artisan config:clear
2021-07-31 16:51:03 +02:00
php artisan storage:link
php artisan config:cache
2021-07-29 23:44:30 +02:00
else
php artisan migrate:refresh
php artisan passport:install
php artisan storage:link
php artisan config:cache
echo "do not remove me" > /2fauth/installed
2021-07-29 23:44:30 +02:00
fi
2021-07-29 23:52:51 +02:00
echo "Nginx listening on :8000"
2021-07-29 23:44:30 +02:00
nginx