DEV Community

Discussion on: Dockerizing a Workspaced Node.js Application

Collapse
 
igorpupkinable profile image
Igor • Edited

Thank you for the fix. However, you may not need a second yarn install to restore links since node_modules should not be copied to Docker and ignored in .dockerignore. Also first stage image can be smaller, ubuntu for example (e.g. ubuntu ~63MB vs node:alpine ~120MB) because you do not really need NodeJS there.

Collapse
 
mbelsky profile image
Max Belsky

Igor, sorry for late reply.

This is an interesting point about choosing stage images. I use node:alpine twice because anyway on second stage I'll need this. So docker downloads it on first stage and takes from cache for second stage. With different images for first and second stages docker will download two images and in total it will spend more time.