Vue.js + Webpack Zero Downtime deployment issues on Laravel Forge
I'm trying to change my deployment script, so that during npm run build, NGINX doesn't return an 500 Server error.
This is my current script:
cd /home/forge/abc.com
git stash
git pull origin $FORGE_SITE_BRANCH
# NVM
. ~/.nvm/nvm.sh
nvm use 16
npm install
npm run build
# Replace public folder contents (nginx root) once build done.
cp -r dist/* public
NGINX is configured to point do the /public folder:
root /home/forge/abc.com/public;
Basically, after building (to the /dist folder), everything should be copied to the /public folder, so theoretically, the /public folder should not be affected by the build process, but once I run npm run build, my served index.html inside of the public folder stays blank, and no built js/css files are injected.
Once the build finished and cp -r is executed, everything is working again.
What am I missing out on?
Please or to participate in this conversation.