Skip to content

Commit 5325cef

Browse files
committed
feat: in-line Yarn data to templates
1 parent e519cfc commit 5325cef

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
@@ -19,7 +19,7 @@ New **Node.js** releases are released as soon as possible.
1919

2020
New **NPM** releases are not tracked. We simply use the NPM version bundled in the corresponding Node.js release.
2121

22-
**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`.
22+
**[Yarn v1 Classic](https://classic.yarnpkg.com/)** is no longer maintained upstream, and will be removed starting with the Node 26 images.
2323

2424
### Submitting a PR for a version update
2525

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,26 +12,24 @@ 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
-b CI config update only
2525
-h Show this message
2626
2727
EOF
2828
}
2929

30-
SKIP=false
3130
while getopts "sh" opt; do
3231
case "${opt}" in
3332
s)
34-
SKIP=true
3533
shift
3634
;;
3735
h)
@@ -65,10 +63,6 @@ fi
6563
# TODO: Should be able to specify target architecture manually
6664
arch=$(get_arch)
6765

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

@@ -139,13 +133,11 @@ function update_node_version() {
139133
'
140134

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

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

0 commit comments

Comments
 (0)