Skip to content

Commit e80ff0f

Browse files
authored
Add Node.js v20 (#51)
1 parent 2ed7392 commit e80ff0f

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

20/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM debian:trixie-slim
2+
3+
ENV NPM_CONFIG_LOGLEVEL=info
4+
ENV NODE_VERSION=20.19.4
5+
6+
# gpg keys listed at https://github.com/nodejs/node
7+
RUN set -ex \
8+
&& apt-get update \
9+
&& apt-get install -y ca-certificates curl gnupg dirmngr xz-utils --no-install-recommends \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
12+
&& export GNUPGHOME="$(mktemp -d)" \
13+
&& for key in \
14+
5BE8A3F6C8A5C01D106C0AD820B1A390B168D356 \
15+
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \
16+
CC68F5A3106FF448322E48ED27F5E38D5B0A215F \
17+
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
18+
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
19+
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
20+
108F52B48DB57BB0CC439B2997B01419BD92F80A \
21+
A363A499291CBBC940DD62E41F10027AF002F8B0 \
22+
; do \
23+
{ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" && gpg --batch --fingerprint "$key"; } || \
24+
{ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" && gpg --batch --fingerprint "$key"; } ; \
25+
done \
26+
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
27+
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
28+
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
29+
&& gpgconf --kill all \
30+
&& rm -rf "$GNUPGHOME" \
31+
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
32+
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
33+
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
34+
&& node --version \
35+
&& npm --version
36+
37+
CMD [ "node" ]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bundle exec rake
2020

2121
The above will run Serverspec and using the docker-api gem it will
2222

23-
- Build a Docker image from the Docker file found in the top level directories (22)
23+
- Build a Docker image from the Docker file found in the top level directories (20 and 22)
2424
- Create a container of that image,
2525
- Run the tests found in `spec/` on the container
2626
- Delete the images and containers if the test was successful

spec/20/Dockerfile_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'serverspec'
2+
require 'docker'
3+
require 'node_tests'
4+
require 'npm_tests'
5+
6+
tag = ENV['TARGET_HOST']
7+
8+
describe "#{tag}" do
9+
include Helpers
10+
11+
before(:all) do
12+
create_image(tag)
13+
end
14+
15+
test_node("20.19.4")
16+
17+
test_npm
18+
19+
after(:all) do
20+
delete_image
21+
end
22+
23+
end

0 commit comments

Comments
 (0)