#NestJS & Docker - How to reduce container size

3 messages · Page 1 of 1 (latest)

marsh remnant
#

Among the apps in my Nx monorepo I have two NestJS APIs that I run in Docker. One problem I'm having is that the main.js that is compiled relies on the node_modules folder and the resulting containers are very large.

What is the suggested way to handle this and either bundle everything up or only install the dependencies that NestJS relies on?

limpid comet
#

What image are you using ? The main.js will contains only what you specify

sour creek
#

@marsh remnant - How are you building your app? What is the command? Look into production building via your package manager. And, I'd suggest using pnpm with --prod or -P flag.