#!/bin/sh set -e APP_DIR=/var/www/app GIT_URL="https://${GIT_TOKEN}@${BACKEND_GIT_REPO}" if [ ! -d "$APP_DIR/.git" ]; then GIT_URL="https://${GIT_TOKEN}@${BACKEND_GIT_REPO}" else cd "$APP_DIR" git pull "$GIT_URL" "${BACKEND_GIT_BRANCH:-main}" fi cd "$APP_DIR" if [ -f composer.json ]; then composer install --no-interaction --prefer-dist --optimize-autoloader fi if [ -d storage ] && [ -d bootstrap/cache ]; then chown -R www-data:www-data storage bootstrap/cache fi if [ -f .env ]; then php artisan key:generate --no-interaction fi php artisan migrate --force exec "$@"