functional docker project
This commit is contained in:
@@ -2,29 +2,36 @@
|
||||
set -e
|
||||
|
||||
APP_DIR=/var/www/app
|
||||
GIT_URL="https://${GIT_TOKEN}@${BACKEND_GIT_REPO}"
|
||||
GIT_URL="https://oauth2:${GIT_TOKEN}@${BACKEND_GIT_REPO}"
|
||||
|
||||
if [ ! -d "$APP_DIR/.git" ]; then
|
||||
GIT_URL="https://${GIT_TOKEN}@${BACKEND_GIT_REPO}"
|
||||
git clone -b "${BACKEND_GIT_BRANCH:-main}" "$GIT_URL" "$APP_DIR"
|
||||
else
|
||||
cd "$APP_DIR"
|
||||
git pull "$GIT_URL" "${BACKEND_GIT_BRANCH:-main}"
|
||||
git fetch origin
|
||||
git reset --hard origin/"${BACKEND_GIT_BRANCH:-main}"
|
||||
fi
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
if [ -f composer.json ]; then
|
||||
composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
composer update --no-interaction --prefer-dist --optimize-autoloader
|
||||
fi
|
||||
|
||||
if [ -d storage ] && [ -d bootstrap/cache ]; then
|
||||
chown -R www-data:www-data storage bootstrap/cache
|
||||
if [ ! -f .env ] && [ -f .env.example ]; then
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
if [ -f .env ]; then
|
||||
php artisan key:generate --no-interaction
|
||||
if [ -f artisan ]; then
|
||||
if ! grep -q "APP_KEY=base64:" .env 2>/dev/null; then
|
||||
php artisan key:generate --ansi --force
|
||||
fi
|
||||
fi
|
||||
|
||||
php artisan migrate --force
|
||||
|
||||
exec "$@"
|
||||
chown -R www-data:www-data storage bootstrap/cache public
|
||||
chmod -R 775 storage bootstrap/cache
|
||||
chmod -R 755 public
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user