From 3d70814520ad9b41579fd0c29316420c1430bdab Mon Sep 17 00:00:00 2001 From: Giovanni Date: Sat, 3 Oct 2026 22:24:13 +0200 Subject: [PATCH] remove unnecessary code --- docker-compose.yml | 1 + docker/frontend/entrypoint.sh | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2f5a467..626f0a3 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,6 +63,7 @@ services: - VITE_ENABLED_TRANSPORTS=${VITE_ENABLED_TRANSPORTS} volumes: - .:/var/www/app${DEV:+:delegated} + - /var/www/app/apps/frontend/node_modules depends_on: php: condition: service_healthy diff --git a/docker/frontend/entrypoint.sh b/docker/frontend/entrypoint.sh index bcedb47..e40e11b 100755 --- a/docker/frontend/entrypoint.sh +++ b/docker/frontend/entrypoint.sh @@ -5,32 +5,36 @@ APP_DIR=/var/www/app FRONTEND_DIR="$APP_DIR/apps/frontend" BACKEND_DIR="$APP_DIR/apps/backend" PUBLIC_DIR="$BACKEND_DIR/public" -PHP_HOST="php" -PHP_PORT=9000 cd "$FRONTEND_DIR" + echo "[FRONTEND BUILD] Installation des dépendances npm..." npm install --prefer-offline --no-audit echo "[FRONTEND BUILD] Compilation Vite/React..." npm run build -if [ -d "$PUBLIC_DIR" ]; then - find "$PUBLIC_DIR" -mindepth 1 \ - ! -name 'index.php' \ - ! -name '.htaccess' \ - ! -name 'storage' \ - -delete -else - mkdir -p "$PUBLIC_DIR" +if [ ! -d "dist" ]; then + echo "❌ Erreur: Le dossier 'dist' n'a pas été généré par Vite." + exit 1 fi +mkdir -p "$PUBLIC_DIR" + +# Nettoyage sécurisé +find "$PUBLIC_DIR" -mindepth 1 \ + ! -name 'index.php' \ + ! -name '.htaccess' \ + ! -name 'storage' \ + -delete 2>/dev/null || true + +echo "[FRONTEND BUILD] Copie vers $PUBLIC_DIR..." cp -r dist/* "$PUBLIC_DIR/" if [ -f "$PUBLIC_DIR/index.html" ]; then mkdir -p "$BACKEND_DIR/resources/views" cp "$PUBLIC_DIR/index.html" "$BACKEND_DIR/resources/views/app.blade.php" - rm "$PUBLIC_DIR/index.html" + rm -f "$PUBLIC_DIR/index.html" fi if [ ! -L "$PUBLIC_DIR/storage" ] && [ ! -e "$PUBLIC_DIR/storage" ]; then @@ -38,5 +42,4 @@ if [ ! -L "$PUBLIC_DIR/storage" ] && [ ! -e "$PUBLIC_DIR/storage" ]; then fi echo "[FRONTEND BUILD] Build React terminé et déployé dans $PUBLIC_DIR ✅" - exit 0