no more problems

This commit is contained in:
2026-02-06 16:03:25 +01:00
parent 8b3616ab73
commit b676145d55
7 changed files with 171 additions and 39 deletions
+3 -34
View File
@@ -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 "$@"