From 00067c56d486149b2eacbb1d25bf09709bf84a0f Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Sat, 25 Jan 2025 22:08:07 -0600 Subject: [PATCH] wip --- docker/entrypoint.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 10698a1..2b54876 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -13,26 +13,25 @@ if [ ! -f ".env" ]; then fi echo -e "\n====================== Validating environment... ====================== " -if [ $(stat -c "%U" .) != "www-data" ]; then - echo " > Setting correct permissions for application..." - chown -R www-data:www-data . -fi +run_as_www_user() { + su - www-data -c "/usr/local/bin/php /var/www/app/artisan $1" +} if ( ! grep -q "^APP_KEY=" ".env" || grep -q "^APP_KEY=$" ".env"); then echo " > Ah, APP_KEY is missing in .env file. Generating a new key!" - su - www-data -c "/usr/local/bin/php artisan key:generate --force" + run_as_www_user "key:generate --force" fi if [ ! -L "public/storage" ]; then echo " > Creating symbolic link for app public storage..." - su - www-data -c "/usr/local/bin/php artisan storage:link" + run_as_www_user "storage:link" fi echo -e "\n====================== Running migrations... ====================== " run_migrations() { - su - www-data -c "/usr/local/bin/php artisan migrate --force" + run_as_www_user "migrate --force" } RETRIES=30 DELAY=5