chore: clean up dockerfile and entrypoint script
This commit is contained in:
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
cd /var/www/app
|
cd /var/www/app
|
||||||
|
|
||||||
echo "====================== Running entrypoint script... ====================== "
|
echo -e "\n====================== Running entrypoint script... ====================== "
|
||||||
if [ ! -f ".env" ]; then
|
if [ ! -f ".env" ]; then
|
||||||
echo " > Ope, gotta create an .env file!"
|
echo " > Ope, gotta create an .env file!"
|
||||||
|
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====================== Installing Composer dependencies... ====================== "
|
echo -e "\n====================== Installing Composer dependencies... ====================== "
|
||||||
/usr/local/bin/composer install
|
/usr/local/bin/composer install
|
||||||
|
|
||||||
echo "====================== Validating environment... ====================== "
|
echo -e "\n====================== Validating environment... ====================== "
|
||||||
if [ $(stat -c '%U' .) != "www-data" ]; then
|
if [ $(stat -c '%U' .) != "www-data" ]; then
|
||||||
echo " > Setting correct permissions for pwd..."
|
echo " > Setting correct permissions for pwd..."
|
||||||
chown -R www-data:www-data .
|
chown -R www-data:www-data .
|
||||||
@@ -30,11 +30,11 @@ if [ ! -L "public/storage" ]; then
|
|||||||
/usr/local/bin/php artisan storage:link
|
/usr/local/bin/php artisan storage:link
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====================== Installing NPM dependencies and building frontend... ====================== "
|
echo -e "\n====================== Installing NPM dependencies and building frontend... ====================== "
|
||||||
/usr/bin/npm install
|
/usr/bin/npm install
|
||||||
/usr/bin/npm run build
|
/usr/bin/npm run build
|
||||||
|
|
||||||
echo "====================== Running migrations... ====================== "
|
echo -e "\n====================== Running migrations... ====================== "
|
||||||
run_migrations() {
|
run_migrations() {
|
||||||
/usr/local/bin/php artisan migrate --force
|
/usr/local/bin/php artisan migrate --force
|
||||||
}
|
}
|
||||||
@@ -43,12 +43,12 @@ DELAY=5
|
|||||||
until run_migrations; do
|
until run_migrations; do
|
||||||
RETRIES=$((RETRIES-1))
|
RETRIES=$((RETRIES-1))
|
||||||
if [ $RETRIES -le 0 ]; then
|
if [ $RETRIES -le 0 ]; then
|
||||||
echo "Database is not ready after multiple attempts. Exiting..."
|
echo " > Database is not ready after multiple attempts. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Waiting for database to be ready... retrying in $DELAY seconds."
|
echo " > Waiting for database to be ready... retrying in $DELAY seconds."
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "====================== Spinning up Supervisor daemon... ====================== "
|
echo -e "\n====================== Spinning up Supervisor daemon... ====================== "
|
||||||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user