-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·44 lines (35 loc) · 950 Bytes
/
Copy pathdocker-entrypoint.sh
File metadata and controls
executable file
·44 lines (35 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Create .env
echo "Creating .env from .env.docker"
cp .env.docker .env
# Wait for the database to be ready
echo "Waiting for database connection..."
while ! nc -z db 3306; do
sleep 1
done
echo "Database is ready!"
# Install dependencies
echo "Installing dependencies..."
composer install --no-interaction --optimize-autoloader
# Generate application key if not set
if [ -z "$(grep -E '^APP_KEY=[a-zA-Z0-9:+\/=]+' .env)" ]; then
echo "Generating application key..."
php artisan key:generate
fi
echo "Generating OpenAPI specification..."
php artisan l5-swagger:generate
# Run migrations
echo "Running migrations..."
php artisan migrate --force --seed
# Clear caches
echo "Clearing caches..."
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
# Set permissions
echo "Setting permissions..."
chmod -R 775 storage bootstrap/cache
# Start PHP-FPM
echo "Starting PHP-FPM..."
php-fpm