Commit c9ad54a3 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix entrypoint: create .env file for key generation in Docker

CapRover injects env vars via Docker, not a .env file. The key:generate
command needs the file to exist to write the generated key.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent f0bc5db1
...@@ -7,8 +7,15 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca ...@@ -7,8 +7,15 @@ mkdir -p storage/framework/{cache/data,sessions,views} storage/logs bootstrap/ca
chown -R www-data:www-data storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache chmod -R 775 storage bootstrap/cache
if [ -z "$APP_KEY" ]; then # Create .env from environment variables if it doesn't exist
if [ ! -f .env ]; then
echo "APP_KEY=" > .env
fi
# Generate APP_KEY if not set
if [ -z "$APP_KEY" ] || [ "$APP_KEY" = "" ]; then
php artisan key:generate --force --no-interaction php artisan key:generate --force --no-interaction
export APP_KEY=$(grep '^APP_KEY=' .env | cut -d= -f2-)
fi fi
php artisan config:cache 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