#!/bin/sh
set -e

if [ ! -f .env ]; then
    echo "Creating .env from .env.docker..."
    cp .env.docker .env
fi

echo "Discovering packages..."
php artisan package:discover --ansi

echo "Caching config..."
php artisan config:cache
php artisan route:cache
php artisan view:cache

echo "Running migrations..."
php artisan migrate --force

echo "Seeding database..."
php artisan db:seed --class=FrozenFoodSeeder --force

exec php-fpm
