From 9d417b8a30042ab65382c919329db08ed119a763 Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Mon, 22 Jul 2024 14:37:21 +0200 Subject: [PATCH] refactor: removed optimization from generic commands --- containers/php/entrypoint.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/containers/php/entrypoint.sh b/containers/php/entrypoint.sh index 2138bf3..fa5835d 100644 --- a/containers/php/entrypoint.sh +++ b/containers/php/entrypoint.sh @@ -6,12 +6,10 @@ if [ -f '.env' ]; then . .env fi -if [ "$APP_ENV" != "local" ]; then - php artisan optimize -fi - if [ "$1" = "php-fpm" ]; then - if [ "$APP_ENV" = "local" ]; then + if [ "$APP_ENV" != "local" ]; then + php artisan optimize + else composer install fi php artisan migrate --force @@ -20,9 +18,15 @@ if [ "$1" = "php-fpm" ]; then fi elif [ "$1" = "scheduler" ]; then wait-for "${PHP_HOST:?Missing PHP_HOST}:${PHP_PORT:?Missing PHP_PORT}" -t 60 + if [ "$APP_ENV" != "local" ]; then + php artisan optimize + fi set -- crond -f -d elif [ "$1" = "worker" ]; then wait-for "${PHP_HOST:?Missing PHP_HOST}:${PHP_PORT:?Missing PHP_PORT}" -t 60 + if [ "$APP_ENV" != "local" ]; then + php artisan optimize + fi set -- su -s /bin/sh -c "php artisan queue:work --tries=3 --timeout=1800" www-data fi