Solid list of tips by the folks over at Snyk:
By the time you’re at number 8 your mind may have dwelled, but don’t skip out on that step though! It not only allows you to build smaller images but also prevents you from having unnecessary files (read: security risks) left inside your container. Basically you install your dependencies in one throwaway container, and then copy the resulting folder into your main container.
10 best practices to containerize Node.js web applications with Docker →