dataloft_test/docker/php/entrypoint.sh
2026-04-05 18:17:09 +07:00

28 lines
867 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
set -e
cd /var/www/html
# Синхронизация Laravel .env с файлом конфигурации Docker (настройки — в файлах, не в ENV хоста).
if [ -f docker/app.env ]; then
cp docker/app.env .env
elif [ ! -f .env ] && [ -f docker/app.env.example ]; then
cp docker/app.env.example .env
fi
if [ ! -d vendor ] || [ ! -f vendor/autoload.php ]; then
composer install --no-interaction --prefer-dist --optimize-autoloader
fi
if [ -f artisan ]; then
mkdir -p storage/framework/{sessions,views,cache} storage/logs bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache 2>/dev/null || true
php artisan config:clear 2>/dev/null || true
if ! grep -q '^APP_KEY=.\{10,\}' .env 2>/dev/null; then
php artisan key:generate --force --ansi || true
fi
php artisan migrate --force --ansi
fi
exec "$@"