update README.md add app-code in docker project

This commit is contained in:
2026-01-30 17:13:01 +01:00
parent e47c36c189
commit c515ab9769
6 changed files with 57 additions and 28 deletions
+18 -10
View File
@@ -4,30 +4,38 @@ 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"
else
cd "$APP_DIR"
git fetch origin
git reset --hard origin/"${BACKEND_GIT_BRANCH:-main}"
# 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}"
fi
cd "$APP_DIR"
if [ -f composer.json ]; then
composer update --no-interaction --prefer-dist --optimize-autoloader
gosu www-data composer update --no-interaction --prefer-dist --optimize-autoloader
fi
cp /tmp/app.env .env
chown www-data:www-data .env
php artisan key:generate --force
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
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