I have a Node.js backend that serves up the React frontend (later I can do CDN probably) and for now, I plan on disallowing CORS so React must talk to my Node.js backend only. The prototype for this is on GitHub.
What I am trying to figure out is how to launch this in a docker container but stripped of all the extra files (such as all the *.ts
files found in node_modules
). Ideally, the Docker container should only contain the code needed to run Node.js and the JavaScript code of the React application (plus JavaScript libraries – albeit compiled from original TypeScript in many cases).
How does one make this happen, as I see a compile only puts my *.ts
files into dist/*.js
files but I do not see any movement on the node_modules/*.js
files to be put anywhere.
Is there no way to do this to keep my Docker image small so uploads from CI/CD are very quick?
I tried the basic tutorials but they all seem to include all the extra files.