remove unnecessary code
This commit is contained in:
1 parent
fbbb563654
commit
02083d6ad3
2 files changed
+19
-16
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /var/www/app/apps/frontend
|
||||||
|
|
||||||
RUN apk add --no-cache git bash
|
RUN apk add --no-cache git bash
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,41 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
FRONTEND_DIR=/app
|
|
||||||
APP_DIR=/var/www/app
|
APP_DIR=/var/www/app
|
||||||
PUBLIC_DIR="$APP_DIR/public"
|
FRONTEND_DIR="$APP_DIR/apps/frontend"
|
||||||
GIT_URL="https://oauth2:${GIT_TOKEN}@${FRONTEND_GIT_REPO}"
|
BACKEND_DIR="$APP_DIR/apps/backend"
|
||||||
|
PUBLIC_DIR="$BACKEND_DIR/public"
|
||||||
PHP_HOST="app-php"
|
PHP_HOST="app-php"
|
||||||
PHP_PORT=9000
|
PHP_PORT=9000
|
||||||
|
|
||||||
/usr/local/bin/wait-for-it.sh "$PHP_HOST:$PHP_PORT" -t 300
|
/usr/local/bin/wait-for-it.sh "$PHP_HOST:$PHP_PORT" -t 300
|
||||||
|
|
||||||
if [ ! -d "$FRONTEND_DIR/.git" ]; then
|
|
||||||
git clone -b "${FRONTEND_GIT_BRANCH:-main}" "$GIT_URL" "$FRONTEND_DIR"
|
|
||||||
else
|
|
||||||
cd "$FRONTEND_DIR"
|
|
||||||
git fetch origin
|
|
||||||
git reset --hard origin/"${FRONTEND_GIT_BRANCH:-main}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp "$APP_DIR/public/index.php" "$FRONTEND_DIR/index.php"
|
|
||||||
|
|
||||||
cd "$FRONTEND_DIR"
|
cd "$FRONTEND_DIR"
|
||||||
npm ci --prefer-offline --no-audit
|
npm ci --prefer-offline --no-audit
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
|
if [ -d "$PUBLIC_DIR" ]; then
|
||||||
find "$PUBLIC_DIR" -mindepth 1 \
|
find "$PUBLIC_DIR" -mindepth 1 \
|
||||||
! -name 'index.php' \
|
! -name 'index.php' \
|
||||||
! -name '.htaccess' \
|
! -name '.htaccess' \
|
||||||
! -name 'storage' \
|
! -name 'storage' \
|
||||||
-delete
|
-delete
|
||||||
|
else
|
||||||
|
mkdir -p "$PUBLIC_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
cp -r dist/* "$PUBLIC_DIR/"
|
cp -r dist/* "$PUBLIC_DIR/"
|
||||||
|
|
||||||
if [ ! -L "$PUBLIC_DIR/storage" ] || [ ! -e "$PUBLIC_DIR/storage" ]; then
|
if [ -f "$PUBLIC_DIR/index.html" ]; then
|
||||||
ln -sfn "$APP_DIR/storage/app/public" "$PUBLIC_DIR/storage"
|
mkdir -p "$BACKEND_DIR/resources/views"
|
||||||
|
cp "$PUBLIC_DIR/index.html" "$BACKEND_DIR/resources/views/app.blade.php"
|
||||||
|
rm "$PUBLIC_DIR/index.html"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -L "$PUBLIC_DIR/storage" ] && [ ! -e "$PUBLIC_DIR/storage" ]; then
|
||||||
|
ln -sfn "$BACKEND_DIR/storage/app/public" "$PUBLIC_DIR/storage"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[FRONTEND BUILD] Build React terminé et déployé dans $PUBLIC_DIR ✅"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
Reference in new issue
Block a user