Skip to content

Conversation

@eYinka
Copy link

@eYinka eYinka commented Oct 24, 2025

The previous image uses an outdated version of Yarn (1.22.22). This commit has now upgraded the package to the latest stable version (4.10.3). We have also updated the cache folder config to follow the new method. See:

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954

eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 24, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 24, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 24, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 24, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
@eYinka eYinka changed the title Upgrade Whitehall's base image to use Yarn 4 Upgrade Whitehall's base image to use Yarn 4 [WHIT-1954] Oct 27, 2025
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 27, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 27, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 27, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 27, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 27, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
Copy link

@matthillco matthillco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've successfully built this docker image against the other PR in Whitehall. No errors and the app spins up fine.

I'm happy to approve this, nice work.

Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment below 🙏

RUN apt-get update -qq && apt-get install -y yarn nodejs
RUN yarn config set cache-folder /root/.yarn/
RUN apt-get update -qq && apt-get install -y nodejs
RUN corepack enable && yarn set version 4.10.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally try to avoid pinning to patch versions - I think I'd replace with this:

Suggested change
RUN corepack enable && yarn set version 4.10.3
RUN corepack enable && yarn set version 4.x

...or is this because it has to match the exact version specified in package.json?
(If they need to be in sync, I'd add an inline comment to that effect, in this Dockerfile ^

Or I wonder if there's something dynamic we can do... something like this (thanks ChatGPT!)...?

# Enable corepack, fetch Yarn version from Whitehall package.json, and install that exact version
RUN corepack enable && \
    YARN_VERSION=$(curl -s https://raw.githubusercontent.com/alphagov/whitehall/main/package.json \
      | jq -r '.packageManager' \
      | sed -E 's/^yarn@//') && \
    yarn set version "$YARN_VERSION"

Copy link
Author

@eYinka eYinka Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting as 4.x works and will pull the latest stable version of v4. Missed that from the docs earlier. Thanks @ChrisBAshton

The previous image uses an outdated version of Yarn (1.22.22). This commit has now upgraded the package to the latest stable version (4.10.3).
We have also updated the cache folder config to follow the new method. See:
 - https://yarnpkg.com/cli/config/set
 - https://yarnpkg.com/configuration/yarnrc#cacheFolder
@eYinka eYinka force-pushed the upgrade-wh-yarn-4 branch from 120d726 to 4c9f0e2 Compare October 28, 2025 17:40
eYinka added a commit to alphagov/whitehall that referenced this pull request Oct 28, 2025
Following the deprecation of Yarn 1.xx and 2.xx, we have upgraded Whitehall's base image to use Yarn v4.
Consequently, flags like `--production` `--frozen-lockfile` have been removed.

Associated PR: alphagov/govuk-docker#908

Flags: https://yarnpkg.com/cli/install

JIRA: https://gov-uk.atlassian.net/browse/WHIT-1954
@ChrisBAshton ChrisBAshton marked this pull request as draft October 29, 2025 10:13
@ChrisBAshton
Copy link
Contributor

Converted to draft. We've decided to hold off until there's support more widely - see issue on Platform Engineering board: alphagov/govuk-infrastructure#3068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants