How should I setup my dist build and production deployment workflow for my Node.js server app? (NestJS API)?
My current workflow:
production
branchpm2
automatically pull changes from this reponpm install
on prod server.npm run build
on prod server.pm2 start
on prod server.The main problem I see in this workflow is that I am running build on production server. This means that I need all devDependencies on server and also I am doing performance spikes on server when building.
I already configured GitHub Actions on my repo to build my code and save it as artifact on commit, but now I am stuck.
pm2
hook on production?/dist
folder (artifact) does not have package.json and assets I don't have all the info I need, but I guess you should run the build step on a CI/CD tool (TravisCI for example), and push the content of the /dist
folder to your production server afterwards. Then, pm2 would only run this production build.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.