Yeah. Yarn is awesome. I stumble into an issue though https://github.com/yarnpkg/yarn/issues/761 basically yarn fails to install only production only dependencies. Luckily I found a solution, since we install all dependencies (both devDependencies and dependencies) to run the tests and create the bundles, we just run
npm prune --productionto remove the dev dependencies and then just copy node_modules into the docker image. at docker image creation we also run
npm rebuild to make sure node modules are recompiled if needed to the target architecture.
I wish they fix this issue, before we used to just
npm install --production and I believe it will be better to use
yarn install --production and just share the yarn cache with the docker image.