Skip to content

Commit 73b535d

Browse files
authored
Merge pull request #2416 from nschonni/yarn-cleanup
feat: in-line Yarn data to templates
2 parents 3061a00 + 4f0b36c commit 73b535d

File tree

6 files changed

+16
-28
lines changed

6 files changed

+16
-28
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ New **Node.js** releases are released as soon as possible.
2727

2828
New **npm** releases are not tracked. We simply use the npm version bundled in the corresponding Node.js release.
2929

30-
**Yarn** is updated to the latest version only when there is a new Node.js SemVer PATCH release (unless Yarn has received a security update), and it's updated only in the branch with the new release, preferably in the same PR. The `update.sh` script does this automatically when invoked with a specific branch, e.g. `./update.sh 6.10`.
30+
**[Yarn v1 Classic](https://classic.yarnpkg.com/)** is no longer maintained upstream, and will be removed starting with the Node 26 images.
3131

3232
### Submitting a PR for a version update
3333

Dockerfile-alpine.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ RUN addgroup -g 1000 node \
7171
&& npm --version \
7272
&& rm -rf /tmp/*
7373

74-
ENV YARN_VERSION=0.0.0
74+
ENV YARN_VERSION=1.22.22
7575

7676
RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar \
7777
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
7878
&& export GNUPGHOME="$(mktemp -d)" \
7979
&& for key in \
80-
"${YARN_KEYS[@]}"
80+
6A010C5166006599AA17F08146C2130DFD2497F5 \
8181
; do \
8282
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
8383
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ; \

Dockerfile-debian.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
3939
&& npm --version \
4040
&& rm -rf /tmp/*
4141

42-
ENV YARN_VERSION=0.0.0
42+
ENV YARN_VERSION=1.22.22
4343

4444
RUN set -ex \
4545
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
4646
&& export GNUPGHOME="$(mktemp -d)" \
4747
&& for key in \
48-
"${YARN_KEYS[@]}"
48+
6A010C5166006599AA17F08146C2130DFD2497F5 \
4949
; do \
5050
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
5151
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ; \

Dockerfile-slim.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ RUN ARCH= OPENSSL_ARCH= && dpkgArch="$(dpkg --print-architecture)" \
5353
&& npm --version \
5454
&& rm -rf /tmp/*
5555

56-
ENV YARN_VERSION=0.0.0
56+
ENV YARN_VERSION=1.22.22
5757

5858
RUN set -ex \
5959
&& savedAptMark="$(apt-mark showmanual)" \
@@ -62,7 +62,7 @@ RUN set -ex \
6262
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
6363
&& export GNUPGHOME="$(mktemp -d)" \
6464
&& for key in \
65-
"${YARN_KEYS[@]}"
65+
6A010C5166006599AA17F08146C2130DFD2497F5 \
6666
; do \
6767
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
6868
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ; \

keys/yarn.keys

Lines changed: 0 additions & 1 deletion
This file was deleted.

update.sh

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,23 @@ function usage() {
1212
1313
Examples:
1414
- update.sh # Update all images
15-
- update.sh -s # Update all images, skip updating Alpine and Yarn
15+
- update.sh -s # Update all images, skip updating Alpine
1616
- update.sh 8,10 # Update all variants of version 8 and 10
17-
- update.sh -s 8 # Update version 8 and variants, skip updating Alpine and Yarn
17+
- update.sh -s 8 # Update version 8 and variants, skip updating Alpine
1818
- update.sh 8 alpine # Update only alpine's variants for version 8
19-
- update.sh -s 8 bullseye # Update only bullseye variant for version 8, skip updating Alpine and Yarn
19+
- update.sh -s 8 bullseye # Update only bullseye variant for version 8, skip updating Alpine
2020
- update.sh . alpine # Update the alpine variant for all versions
2121
2222
OPTIONS:
23-
-s Security update; skip updating the yarn and alpine versions.
23+
-s Security update; skip updating the Alpine versions.
2424
-h Show this message
2525
2626
EOF
2727
}
2828

29-
SKIP=false
3029
while getopts "sh" opt; do
3130
case "${opt}" in
3231
s)
33-
SKIP=true
3432
shift
3533
;;
3634
h)
@@ -64,10 +62,6 @@ fi
6462
# TODO: Should be able to specify target architecture manually
6563
arch=$(get_arch)
6664

67-
if [ "${SKIP}" != true ]; then
68-
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
69-
fi
70-
7165
function in_versions_to_update() {
7266
local version=$1
7367

@@ -138,13 +132,11 @@ function update_node_version() {
138132
'
139133

140134
# Add GPG keys
141-
for key_type in "node" "yarn"; do
142-
while read -r line; do
143-
pattern='"\$\{'$(echo "${key_type}" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"'
144-
sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}-tmp"
145-
done < "keys/${key_type}.keys"
146-
sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp"
147-
done
135+
while read -r line; do
136+
pattern='"\$\{'$(echo "node" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"'
137+
sed -Ei -e "s/([ \\t]*)(${pattern})/\\1${line}${new_line}\\1\\2/" "${dockerfile}-tmp"
138+
done < "keys/node.keys"
139+
sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp"
148140

149141
if is_alpine "${variant}"; then
150142
alpine_version="${variant#*alpine}"
@@ -167,9 +159,6 @@ function update_node_version() {
167159
if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then
168160
echo "${dockerfile} is already up to date!"
169161
else
170-
if [ "${SKIP}" != true ]; then
171-
sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp"
172-
fi
173162
echo "${dockerfile} updated!"
174163
fi
175164

0 commit comments

Comments
 (0)