2FAuth/docker/entrypoint.sh

44 lines
1.0 KiB
Bash
Raw Normal View History

2021-07-29 23:44:30 +02:00
#!/bin/bash
2021-07-29 23:52:11 +02:00
set -e
2021-07-29 23:44:30 +02:00
2021-08-02 17:28:03 +02:00
# Show versions
echo "supervisord version: $(supervisord version)"
php-fpm7.3 -v | head -n 1
nginx -v
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
# Note: ${COMMIT} is set by the CI
2021-07-29 23:44:30 +02:00
if [ -f /2fauth/installed ]; then
INSTALLED_COMMIT="$(cat /2fauth/installed)"
if [ "${INSTALLED_COMMIT}" != "${COMMIT}" ]; then
echo "Installed commit ${INSTALLED_COMMIT} is different from program commit ${COMMIT}, we are migrating..."
php artisan migrate
php artisan config:clear
fi
2021-07-29 23:44:30 +02:00
else
php artisan migrate:refresh
php artisan passport:install
fi
echo "${COMMIT}" > /2fauth/installed
2021-08-02 18:35:01 +02:00
php artisan storage:link
php artisan config:cache
2021-08-02 17:27:21 +02:00
supervisord