Commit 72ec2356 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix entrypoint: copy .env.example before key:generate

Laravel's key:generate reads the .env file content; it must exist and be
parseable before the command runs.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 642200f4
......@@ -7,15 +7,14 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
# Create .env from environment variables if it doesn't exist
# Create .env file — Laravel's key:generate needs it to exist
if [ ! -f .env ]; then
echo "APP_KEY=" > .env
cp .env.example .env 2>/dev/null || echo "APP_KEY=" > .env
fi
# Generate APP_KEY if not set
if [ -z "$APP_KEY" ] || [ "$APP_KEY" = "" ]; then
# Generate APP_KEY if not set via environment
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction
export APP_KEY=$(grep '^APP_KEY=' .env | cut -d= -f2-)
fi
php artisan config:cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment