remove unnecessary code
This commit is contained in:
1 parent
840808daee
commit
3d70814520
2 files changed
+16
-12
No files matched your search
@@ -63,6 +63,7 @@ services:
|
|||||||
- VITE_ENABLED_TRANSPORTS=${VITE_ENABLED_TRANSPORTS}
|
- VITE_ENABLED_TRANSPORTS=${VITE_ENABLED_TRANSPORTS}
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www/app${DEV:+:delegated}
|
- .:/var/www/app${DEV:+:delegated}
|
||||||
|
- /var/www/app/apps/frontend/node_modules
|
||||||
depends_on:
|
depends_on:
|
||||||
php:
|
php:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
@@ -5,32 +5,36 @@ APP_DIR=/var/www/app
|
|||||||
FRONTEND_DIR="$APP_DIR/apps/frontend"
|
FRONTEND_DIR="$APP_DIR/apps/frontend"
|
||||||
BACKEND_DIR="$APP_DIR/apps/backend"
|
BACKEND_DIR="$APP_DIR/apps/backend"
|
||||||
PUBLIC_DIR="$BACKEND_DIR/public"
|
PUBLIC_DIR="$BACKEND_DIR/public"
|
||||||
PHP_HOST="php"
|
|
||||||
PHP_PORT=9000
|
|
||||||
|
|
||||||
cd "$FRONTEND_DIR"
|
cd "$FRONTEND_DIR"
|
||||||
|
|
||||||
echo "[FRONTEND BUILD] Installation des dépendances npm..."
|
echo "[FRONTEND BUILD] Installation des dépendances npm..."
|
||||||
npm install --prefer-offline --no-audit
|
npm install --prefer-offline --no-audit
|
||||||
|
|
||||||
echo "[FRONTEND BUILD] Compilation Vite/React..."
|
echo "[FRONTEND BUILD] Compilation Vite/React..."
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
if [ -d "$PUBLIC_DIR" ]; then
|
if [ ! -d "dist" ]; then
|
||||||
find "$PUBLIC_DIR" -mindepth 1 \
|
echo "❌ Erreur: Le dossier 'dist' n'a pas été généré par Vite."
|
||||||
! -name 'index.php' \
|
exit 1
|
||||||
! -name '.htaccess' \
|
|
||||||
! -name 'storage' \
|
|
||||||
-delete
|
|
||||||
else
|
|
||||||
mkdir -p "$PUBLIC_DIR"
|
|
||||||
fi
|
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/"
|
cp -r dist/* "$PUBLIC_DIR/"
|
||||||
|
|
||||||
if [ -f "$PUBLIC_DIR/index.html" ]; then
|
if [ -f "$PUBLIC_DIR/index.html" ]; then
|
||||||
mkdir -p "$BACKEND_DIR/resources/views"
|
mkdir -p "$BACKEND_DIR/resources/views"
|
||||||
cp "$PUBLIC_DIR/index.html" "$BACKEND_DIR/resources/views/app.blade.php"
|
cp "$PUBLIC_DIR/index.html" "$BACKEND_DIR/resources/views/app.blade.php"
|
||||||
rm "$PUBLIC_DIR/index.html"
|
rm -f "$PUBLIC_DIR/index.html"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -L "$PUBLIC_DIR/storage" ] && [ ! -e "$PUBLIC_DIR/storage" ]; then
|
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
|
fi
|
||||||
|
|
||||||
echo "[FRONTEND BUILD] Build React terminé et déployé dans $PUBLIC_DIR ✅"
|
echo "[FRONTEND BUILD] Build React terminé et déployé dans $PUBLIC_DIR ✅"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
Reference in new issue
Block a user