no more problems
This commit is contained in:
@@ -1,42 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
APP_DIR=/var/www/app
|
||||
GIT_URL="https://oauth2:${GIT_TOKEN}@${BACKEND_GIT_REPO}"
|
||||
|
||||
# Si le dossier app-code est vide ou n'existe pas, on le prépare
|
||||
if [ ! -d "$APP_DIR/.git" ]; then
|
||||
# Créer le dossier avec les bonnes permissions si nécessaire
|
||||
mkdir -p "$APP_DIR"
|
||||
|
||||
# Cloner en tant que root d'abord
|
||||
git clone -b "${BACKEND_GIT_BRANCH:-main}" "$GIT_URL" "$APP_DIR"
|
||||
|
||||
# Puis changer TOUS les propriétaires vers www-data
|
||||
chown -R www-data:www-data "$APP_DIR"
|
||||
if [ "$DEV" = 1 ]; then
|
||||
/usr/local/bin/init-dev.sh
|
||||
else
|
||||
cd "$APP_DIR"
|
||||
# S'assurer que www-data possède le dossier avant fetch
|
||||
chown -R www-data:www-data "$APP_DIR"
|
||||
gosu www-data git fetch origin
|
||||
gosu www-data git reset --hard origin/"${BACKEND_GIT_BRANCH:-main}"
|
||||
/usr/local/bin/init-prod.sh
|
||||
fi
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
if [ -f composer.json ]; then
|
||||
gosu www-data composer update --no-interaction --prefer-dist --optimize-autoloader
|
||||
fi
|
||||
|
||||
cp /tmp/app.env .env
|
||||
chown www-data:www-data .env
|
||||
|
||||
gosu www-data php artisan key:generate --force
|
||||
gosu www-data php artisan config:clear
|
||||
gosu www-data php artisan cache:clear
|
||||
gosu www-data php artisan migrate --force
|
||||
|
||||
chmod -R 775 storage bootstrap/cache
|
||||
chmod -R 755 public
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user