This commit is contained in:
unknown committed 2026-10-17 14:25:27 +07:00
1 parent 5ba4afb2de
commit 731619af9d
4 files changed
+109 -8

No files matched your search

+21 -2
View File
@@ -12,6 +12,7 @@ export PATH="/home/sql/.bun/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
# 1. PATH CONFIG
GIT_DIR="/home/sql/git/bigbike.git"
WORK_DIR="/home/sql/code/bigbike"
TARGET_ADMIN="/var/www/html/bigbike_admin"
BRANCH="master"
TEMP_DIR="/tmp/bigbike_build_$(date +%s)"
@@ -80,7 +81,25 @@ if [ -d "apps/backend" ]; then
cd "$WORK_DIR"
fi
# D. Setup Website SSR (if apps/website exists)
# D. Build & Deploy Admin Panel (React Vite SPA)
if [ -d "apps/admin" ]; then
echo ">>> Building Admin Panel (React Vite SPA)..."
cd "$WORK_DIR/apps/admin"
export VITE_API_URL="https://api.bigbike.ddcsprocket.com/api"
export VITE_FRONTEND_URL="https://bigbike.ddcsprocket.com"
$BUN run build
if [ -d "$TARGET_ADMIN" ]; then
echo "Deploying Admin Panel to $TARGET_ADMIN..."
rsync -av --delete dist/ "$TARGET_ADMIN"/
else
echo "⚠️ Target directory $TARGET_ADMIN not found. Please create it once with:"
echo " sudo mkdir -p $TARGET_ADMIN && sudo chown -R sql:sql $TARGET_ADMIN"
fi
cd "$WORK_DIR"
fi
# E. Setup Website SSR (if apps/website exists)
if [ -d "apps/website" ]; then
echo ">>> Building Next.js Website..."
cd "$WORK_DIR/apps/website"
@@ -101,7 +120,7 @@ if [ -d "apps/website" ]; then
cd "$WORK_DIR"
fi
# E. Save PM2 state
# F. Save PM2 state
$PM2 save
echo "========================================================"