1

I would to build a Docker image using multi-stage. We are using yarn 2 and Zero installs feature which stores dependencies in .yarn/cache under zip format.

To minimize the size of my Docker image, I would like to only have the production dependencies. Previsously, we would do

yarn install  --non-interactive --production=true

But by doing that with a former version of yarn, we don't benefit from the .yarn/cache folder and it takes time to download dependencies whereas there are already here but not readable by the former version of yarn.

Is there a way to tell yarn 2 to get only production dependencies from the .yarn/cache folder and put it into another one ? Thus I could copy this folder inside my image and save time and space.

Coulemelle
  • 341
  • 1
  • 4
  • 13

0 Answers0