I am trying to create an image using a multi-stage build for a node project. I am using NestJs for the project since it uses TypeScript, and if I install only production dependency in the production stage it will not install NestJs CLI. Now, NestJs CLI is required to compile all the TypeScipt code to JavaScript. Most of the people or the blogs I have read, what they do is copy the output folder (compiled code from TypeScript to JavaScript) in the production stage which I don't want to do and really don't like the idea of copying the output folder because if I run only production stage via compose or a container it will fail.
Now, I have two options, either I can move the NestJs CLI as dependencies required for production in my package.json file, or I can add NestJs CLI via a RUN command in my Dockerfile, I want to know what would be right or the best way to do it.