I recently updated my docker image for my build from cimg/ruby:2.7.7-browsers to cimg/ruby:3.0.6-browsers and after the update, my yarn install
step is taking ~50 seconds, whereas before it was taking ~0.5 seconds.
The node version I’m using is 18.12.1
According to the CircleCI cimg/ruby docs the node version mentioned for cimg/ruby:2.7.7-browsers is 18.12.1 (which matches the version set for my app) and cimg/ruby:3.0.6-browsers is 18.15.0.
What it is it about the difference in node versions that could be resulting in this spike in time?
As an experiment I tried switching my apps ruby version to 3.0.5 and going with cimg/ruby:3.0.5 uses node version 18.12.1 and this resulted in a yarn install
step that again took ~0.5 seconds. This seems to confirm that something about the node version being different is resulting in this extra slowdown but it’s not clear from the logs what this might be.
These are the relevant steps in my config.yml
. bundle exec rake assets:precompile
calls yarn install
.
- run:
name: Creating Vite build cache key
command: find app/frontend -type f -exec md5sum {} \; > vite_build_assets_checksum
- restore_cache:
name: "Restoring cached Vite build"
keys:
- vite-build-v1-{{ checksum "vite_build_assets_checksum" }}-{{ checksum "vite.config.ts" }}
- vite-build-v1-
- restore_cache:
name: "Restoring cached node_modules"
keys:
- node-modules-v5-{{ checksum "yarn.lock" }}
- node-modules-v5-
- run:
name: Precompile assets (and yarn install)
command: bundle exec rake assets:precompile | while read line; do echo "$(date +%T) > $line"; done;
- save_cache:
name: "Caching node modules"
key: node-modules-v5-{{ checksum "yarn.lock" }}
paths:
- node_modules
- save_cache:
name: "Caching Vite build"
key: vite-build-v1-{{ checksum "vite_build_assets_checksum" }}-{{ checksum "vite.config.ts" }}
paths:
- public/vite-test
- tmp/cache/vite