Last active
December 8, 2024 18:48
-
-
Save Kamleshpaul/d22887c48e0c0d231734da24e8a80660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#zero downtime deployment nextjs without vercel | |
echo "Deploy starting..." | |
git pull | |
npm install || exit | |
BUILD_DIR=temp npm run build || exit | |
if [ ! -d "temp" ]; then | |
echo '\033[31m temp Directory not exists!\033[0m' | |
exit 1; | |
fi | |
rm -rf .next | |
mv temp .next | |
pm2 reload app --update-env | |
echo "Deploy done." | |
#make sure `next.config.js` it set `distDir: process.env.BUILD_DIR` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment