Skip to content

Commit 9f77e88

Browse files
committed
Stop using Yarn APT repo and install Yarn via Corepack
The Yarn Debian APT repository is signed with an expired GPG key, which now causes builds to fail on recent versions of APT. The error is: 0.571 W: https://dl.yarnpkg.com/debian/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details. 0.571 W: GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx> 0.571 E: The repository 'https://dl.yarnpkg.com/debian stable InRelease' is not signed. Rather than relying on the deprecated Yarn APT repo, install Yarn via Corepack, which is bundled with Node.js and is the recommended way to manage Yarn going forward. (https://www.docs4dev.com/docs/yarn/berry/getting-started/install.html) This avoids GPG key expiry issues and makes the build more robust to future APT security changes.
1 parent 0d7c321 commit 9f77e88

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Dockerfile.govuk-base

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt-get update -qq && \
1010
apt-get install -y --no-install-recommends \
1111
build-essential \
1212
autoconf bison \
13+
clang \
1314
libssl-dev \
1415
libreadline-dev \
1516
zlib1g-dev \
@@ -18,12 +19,14 @@ RUN apt-get update -qq && \
1819

1920
# Enable no-sandbox for chrome so that it can run as a root user
2021
ENV GOVUK_TEST_CHROME_NO_SANDBOX 1
22+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
23+
24+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
25+
&& apt-get update -qq \
26+
&& apt-get install -y nodejs \
27+
&& corepack enable \
28+
&& corepack prepare yarn@1.22.22 --activate
2129

22-
# Install node / yarn
23-
RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
24-
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
25-
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
26-
RUN apt-get update -qq && apt-get install -y yarn nodejs
2730
RUN yarn config set cache-folder /root/.yarn/
2831

2932
# Install rbenv to manage ruby versions

0 commit comments

Comments
 (0)