I'm building a NodeJS app wrapped into a Docker container. I want to make this image as light as possible. I've already applied the usual techniques like installing only prod deps, using node-prune etc. But my node_modules folder is still huge and filled mostly with typescript, tslib, type definitions etc.
Since I need to run tsc inside the container, I assume I can somehow clean up the node_modules after it.
RUN tsc
I could just RUN rm node_modules/something commands, but this seems like a dangerous approach. Is there a better way to lighten docker container with a tsc app?