CaiWuXiTong/deploy/entrypoint.sh

37 lines
795 B
Bash

#!/bin/sh
set -eu
mkdir -p \
storage/app/public \
storage/app/temp \
storage/app/uploads \
storage/framework/cache/data \
storage/framework/sessions \
storage/framework/views \
storage/logs \
bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
if [ -f .env ]; then
chown www-data:www-data .env
chmod 660 .env
fi
if [ "${1:-}" = "apache2-foreground" ]; then
sed -ri 's/^Listen 80$/Listen 18088/' /etc/apache2/ports.conf
php artisan optimize:clear
php artisan package:discover --ansi
if grep -Eq '^APP_INSTALLED=(true|1)$' .env; then
if [ "${RUN_MIGRATIONS:-0}" = "1" ]; then
php artisan migrate --force
fi
php artisan config:cache
php artisan view:cache
fi
fi
exec "$@"