DEV Community

Discussion on: How To Build a Node.js Application with Docker [Quickstart]

Collapse
 
chrisme profile image
Chris

To keep the image as small as possible you can delete the cache npm builds

RUN npm install --production && npm cache clean --force

And by putting "fix" settings that don't change, like

EXPOSE 8080

towards the beginning of the Dockerfile you can sometimes save build time because docker can build upon existing layers that didn't change.