pixelfed/entrypoint.fpm.sh

41 lines
1.1 KiB
Bash
Raw Normal View History

2023-08-09 09:13:30 +00:00
#!/usr/bin/env bash
set -xeo pipefail
2023-10-20 16:35:38 +00:00
rsync -a --delete storage.skel/* storage/
rsync -a --delete public.skel/ public/
2023-08-09 09:13:30 +00:00
chown -R www-data:www-data storage/ bootstrap/
php /wait-for-db.php
if [[ ! -e storage/.docker.init ]]
then
echo "Fresh installation, initializing database..."
gosu www-data php artisan key:generate
gosu www-data php artisan migrate:fresh --force
gosu www-data php artisan passport:keys
echo completed > storage/.docker.init
fi
gosu www-data php artisan storage:link
gosu www-data php artisan horizon:publish
gosu www-data php artisan config:cache
gosu www-data php artisan cache:clear
gosu www-data php artisan route:cache
gosu www-data php artisan view:cache
2023-08-10 14:47:22 +00:00
rsync --archive --delete public/ /public/
2023-08-09 09:13:30 +00:00
echo "++++ Check for needed migrations... ++++"
# check for migrations
gosu www-data php artisan migrate:status | grep No && migrations=yes || migrations=no
gosu www-data php artisan migrate:status | grep Pending && migrations=yes || migrations=no
2023-08-10 14:47:22 +00:00
if [ "$migrations" = "yes" ];
2023-08-09 09:13:30 +00:00
then
gosu www-data php artisan migrate --force
fi
# create instance actor
gosu www-data php artisan instance:actor
dumb-init docker-php-entrypoint -F