#!/bin/bash set -e if [ "$1" = "php-fpm" ]; then [ -d vendor ] || composer install --no-interaction --prefer-dist [ -f .env ] || cp .env.example .env grep -q '^APP_KEY=.\+' .env || php artisan key:generate --no-interaction until php -r "new PDO('pgsql:host=${DB_HOST};port=${DB_PORT};dbname=${DB_DATABASE}', '${DB_USERNAME}', '${DB_PASSWORD}');" >/dev/null 2>&1; do echo "waiting for postgres..." sleep 2 done php artisan migrate --force --no-interaction php artisan storage:link --no-interaction || true chown -R www-data:www-data storage bootstrap/cache fi exec "$@"