This commit is contained in:
2026-04-06 15:26:52 +00:00
parent 966c3c3d76
commit 8592f68918
2 changed files with 18 additions and 91 deletions

View File

@@ -1,43 +1,15 @@
#!/bin/bash
set -e
echo "=== Next.js Standalone Build ==="
APP_DIR=$(pwd)
BUILD_DIR=".next"
STANDALONE_DIR=".next/standalone"
echo "1. Installing dependencies..."
npm install
echo "2. Building Next.js..."
npm run build
echo "3. Preparing standalone structure..."
echo "Copying required files..."
# ensure directories exist
mkdir -p $STANDALONE_DIR/.next
# CHỈ cần 2 dòng này
cp -r .next/static .next/standalone/.next/
cp -r public .next/standalone/
# copy static assets
echo "Copying static assets..."
cp -r $BUILD_DIR/static $STANDALONE_DIR/.next/ 2>/dev/null || true
# copy public folder
if [ -d "public" ]; then
echo "Copying public folder..."
cp -r public $STANDALONE_DIR/
fi
echo "4. Creating deploy package..."
tar -czf standalone-deploy.tar.gz \
-C $STANDALONE_DIR . \
-C $APP_DIR public 2>/dev/null || true
echo ""
echo "Build completed."
echo "Deploy file: standalone-deploy.tar.gz"
echo ""
echo "Run on server:"
echo "PORT=3005 node server.js"
echo "Done"