Skip to content

Commit 45253a2

Browse files
authored
Upgrade to node.js 20 (#609)
1 parent b5d07a5 commit 45253a2

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

.devcontainer/Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/javascript-node/.devcontainer/base.Dockerfile
22
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
3-
ARG VARIANT=16-bullseye
4-
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
3+
ARG VARIANT=20-bookworm
4+
FROM mcr.microsoft.com/devcontainers/javascript-node:1-${VARIANT}
55

66
# [Optional] Uncomment this section to install additional OS packages.
77
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
8-
&& apt-get -y install --no-install-recommends python pip
8+
&& apt-get -y install --no-install-recommends python3 python3-pip
99

1010
# [Optional] Uncomment if you want to install an additional version of node using nvm
1111
# ARG EXTRA_NODE_VERSION=10
@@ -17,6 +17,14 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1717
# Update npm
1818
RUN npm install -g npm
1919
# Intall aws cli
20-
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install
20+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
21+
unzip awscliv2.zip && \
22+
sudo ./aws/install && \
23+
rm -rf ./aws && \
24+
rm awscliv2.zip
2125
# Install sam cli
22-
RUN pip install aws-sam-cli
26+
RUN curl -L "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-$(dpkg --print-architecture).zip" -o "aws-sam-cli.zip" && \
27+
unzip aws-sam-cli.zip -d sam-installation && \
28+
sudo ./sam-installation/install && \
29+
rm -rf ./sam-installation && \
30+
rm aws-sam-cli.zip

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
88
// Append -bullseye or -buster to pin to an OS version.
99
// Use -bullseye variants on local arm64/Apple Silicon.
10-
"args": { "VARIANT": "16-bullseye" }
10+
"args": { "VARIANT": "20-bookworm" }
1111
},
1212

1313
"settings": {},
@@ -34,4 +34,4 @@
3434

3535
"remoteUser": "node",
3636

37-
}
37+
}

.github/workflows/node-ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ jobs:
1515
- name: Setup node
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: 16.x
18+
node-version: ${{ matrix.node-version }}
1919
cache: npm
2020
- run: npm install
2121
- run: npm run test:unit:ci
22+
strategy:
23+
matrix:
24+
node-version:
25+
- 18
26+
- 20

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16
1+
v20

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16-alpine
1+
FROM node:20-alpine
22
WORKDIR /opt/safe-settings
33
ENV NODE_ENV production
44
## Set the Labels
@@ -8,12 +8,12 @@ LABEL version="1.0" \
88

99
## These files are copied separately to allow updates
1010
## to the image to be as small as possible
11-
COPY package.json /opt/safe-settings/
11+
COPY package*.json /opt/safe-settings/
1212
COPY index.js /opt/safe-settings/
1313
COPY lib /opt/safe-settings/lib
1414

1515
## Install the app and dependencies
16-
RUN npm install
16+
RUN npm ci
1717

1818
## This app will listen on port 3000
1919
EXPOSE 3000
@@ -22,4 +22,4 @@ USER node
2222

2323
## This does not start properly when using the ['npm','start'] format
2424
## so stick with just calling it outright
25-
CMD npm start
25+
CMD npm start

serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ frameworkVersion: '3'
55

66
provider:
77
name: aws
8-
runtime: nodejs16.x
8+
runtime: nodejs20.x
99
lambdaHashingVersion: 20201221
1010
environment:
1111
APP_ID: ${param:APP_ID}

0 commit comments

Comments
 (0)