Repository navigation
chore(docker): install Yarn 1 when the base image lacks it (node:26 images no longer include it) - #414
Conversation
…mages no longer include it) Official node:26 images no longer include Yarn (nodejs/docker-node#2407); node:14-24 images do. Every stage that runs yarn now starts with RUN command -v yarn >/dev/null || npm install -g yarn@1.22.22: a no-op on today's base image (its bundled Yarn stays), and Yarn 1.22.22 once the image moves to Node 26, instead of a failed build.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Why
Official
node:26images no longer include Yarn (nodejs/docker-node#2407). Every image up to Node 24 does. Moving a Dockerfile here to Node 26 would fail at the firstyarncommand withyarn: not found. That already happened in another repo on 2026-11-03.What
Every build stage that runs
yarnnow starts, right after itsFROM, with:RUN command -v yarn >/dev/null || npm install -g yarn@1.22.22node:26it installs Yarn 1.22.22, the final Yarn 1 release.FROM, so it runs as root before anyUSERline.npm install -g yarnwould fail on the current images, because Yarn is already installed. That's why the line checks first.Proof
Dockerfile: 1 stage(s) patched; buildx --check before [none], after [none]Lint: the
docker buildx build --checkfindings listed are the same before and after this change. Any finding there was already in the file.The images in use ship Yarn: the official Node images from 14 to 24, in every variant used across the org, ship Yarn 1.22.19 or 1.22.22 (checked with
docker run). So this line is a no-op there.Full builds: the line was proven in full builds of the enrolled repos' Dockerfiles, and on
node:26-alpine, where it installs Yarn 1.22.22.