I’m working on a large monolithic project using Laravel and Vue, and I’m running into a major issue with CPU usage during deployments. Currently, whenever I run npm run prod
, the CPU on my server hits 100%, and the build process takes around 15 minutes to complete, severely affecting performance.
My current setup involves an EC2 instance on AWS, and I’m wondering if there’s a way to offload the build process to a completely separate server instead of running it on my production server. My idea is to run the build on a different server and then simply copy the built files over to production.
Has anyone tried this approach, or is there a recommended way to handle such scenarios? I’m open to suggestions on best practices for optimizing the deployment process for large Laravel/Vue projects.
Any help or guidance would be greatly appreciated!
Thanks in advance!
I think what you can do is, build the application locally then deploy the built scripts for vue js, in that case you dont have to run
npm run prod
in production, run the build script locally,
Once the build is complete, move the built files (typically located in public/js, public/css, and public/mix-manifest.json) to production with you version control system (GIT).