Files
SAE-BUT2-docker/docker/php/entrypoint.sh
T

34 lines
694 B
Bash

#!/bin/sh
set -e
APP_DIR=/var/www/app
GIT_URL="https://oauth2:${GIT_TOKEN}@${BACKEND_GIT_REPO}"
if [ ! -d "$APP_DIR/.git" ]; then
git clone -b "${BACKEND_GIT_BRANCH:-main}" "$GIT_URL" "$APP_DIR"
else
cd "$APP_DIR"
git fetch origin
git reset --hard origin/"${BACKEND_GIT_BRANCH:-main}"
fi
cd "$APP_DIR"
if [ -f composer.json ]; then
composer update --no-interaction --prefer-dist --optimize-autoloader
fi
cp /tmp/app.env .env
php artisan key:generate --force
php artisan config:clear
php artisan cache:clear
php artisan migrate --force
chown -R www-data:www-data public/ storage bootstrap/cache public vendor
chmod -R 775 storage bootstrap/cache
chmod -R 755 public
exec "$@"