Skip to content

Commit b3720d0

Browse files
Use Node 22 for chaincode Docker image (#436)
Signed-off-by: Mark S. Lewis <[email protected]>
1 parent 3d8daa6 commit b3720d0

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

COMPATIBILITY.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ Github is used for code base management, issues should reported in the repositor
66

77
This table shows the summary of the compatibility of the Node modules at versions 1.4 and 2.x, together with the Node.js runtime they require and the Fabric Peer versions they can communicate with.
88

9-
| Chaincode Docker image | Peer connectivity v1.4 | Peer connectivity v2.x | Minimum supported Node.js | Node.js runtime |
10-
| --- | --- | --- | --- | --- |
11-
| **v1.4.5** | Yes | Yes | 8 | 8 |
12-
| **v2.2.x** | Yes | Yes | 12 | 12 |
13-
| **v2.3.x** | Yes | Yes | 12 | 12 |
14-
| **v2.4.x** | Yes | Yes | 16 | 16 |
15-
| **v2.5.0** - **v2.5.4** | Yes | Yes | 18 | 18 |
16-
| **v2.5.5+** | Yes | Yes | 18 | 20 |
9+
| Chaincode Docker image | Peer connectivity v1.4 | Peer connectivity v2.x | Minimum supported Node.js | Node.js runtime |
10+
| ----------------------- | ---------------------- | ---------------------- | ------------------------- | --------------- |
11+
| **v1.4.5** | Yes | Yes | 8 | 8 |
12+
| **v2.2.x** | Yes | Yes | 12 | 12 |
13+
| **v2.3.x** | Yes | Yes | 12 | 12 |
14+
| **v2.4.x** | Yes | Yes | 16 | 16 |
15+
| **v2.5.0** - **v2.5.4** | Yes | Yes | 18 | 18 |
16+
| **v2.5.5** - **v2.5.7** | Yes | Yes | 18 | 20 |
17+
| **v2.5.8+** | Yes | Yes | 18 | 22 |
1718

1819
Whilst these are defaults based on the corresponding `fabric-nodeenv` Docker image version, the Docker image used to host the chaincode and contracts can be altered. Set the environment variable `CORE_CHAINCODE_NODE_RUNTIME` on the peer to the name of the desired Docker image and version.
1920

@@ -43,24 +44,25 @@ Node modules that are produced are `fabric-contract-api`, `fabric-shim` & `fabri
4344

4445
### Supported Runtimes
4546

46-
* Fabric v1.4 Node.js chaincode modules are supported running Nodejs 8.16.1 with the x86_64 architecture.
47-
* Fabric v2.2/v2.3 Node.js chaincode modules are supported running in Node.js 12.22.6, with the x86_64 architecture.
48-
* Fabric v2.4 Node.js chaincode modules are supported running in Node.js 16.x, with the x86_64 architecture.
49-
* Fabric v2.5.x Node.js chaincode modules are supported running in Node.js 18.x, with the x86_64 and arm64 architectures.
47+
- Fabric v1.4 Node.js chaincode modules are supported running Nodejs 8.16.1 with the x86_64 architecture.
48+
- Fabric v2.2/v2.3 Node.js chaincode modules are supported running in Node.js 12.22.6, with the x86_64 architecture.
49+
- Fabric v2.4 Node.js chaincode modules are supported running in Node.js 16.x, with the x86_64 architecture.
50+
- Fabric v2.5.x Node.js chaincode modules are supported running in Node.js 18.x, with the x86_64 and arm64 architectures.
5051

5152
Architecture Support: all Docker images, runtimes, tools are tested under x86_64 ONLY
5253

5354
### Default Peer Runtime selection
5455

55-
* Fabric 2.2/2.3 `fabric-nodeenv` Docker image is based on node:12.22.6-alpine.
56-
* Fabric 2.4 `fabric-nodeenv` Docker image is based on node:16-alpine.
57-
* Fabric 2.5.0 - 2.5.4 `fabric-nodeenv` Docker image is based on node:18-alpine.
58-
* Fabric 2.5.5+ `fabric-nodeenv` Docker image is based on node:20-alpine.
56+
- Fabric 2.2/2.3 `fabric-nodeenv` Docker image is based on node:12.22.6-alpine.
57+
- Fabric 2.4 `fabric-nodeenv` Docker image is based on node:16-alpine.
58+
- Fabric 2.5.0 - 2.5.4 `fabric-nodeenv` Docker image is based on node:18-alpine.
59+
- Fabric 2.5.5+ `fabric-nodeenv` Docker image is based on node:20-alpine.
60+
- Fabric 3.0 `fabric-nodeenv` Docker image is based on node:22-alpine
5961

60-
*Note:* With the default Docker image used by Fabric 2.x, the packaged code will be installed with npm. If a `package-lock.json` or a `npm-shrinkwrap.json` file is present, `npm ci --only=production` will be used. Otherwise `npm install --production` will be used. 
62+
_Note:_ With the default Docker image used by Fabric 2.x and later, the packaged code will be installed with npm. If a `package-lock.json` or a `npm-shrinkwrap.json` file is present, `npm ci --only=production` will be used. Otherwise `npm install --production` will be used.
6163

6264
When using Fabric 1.4.x, the Docker image that is used to run the Node.js chaincode is node v8.16.1. It is installed with npm install --production
6365

6466
### Supported Runtime communication with the Peer
6567

66-
Subject to a suitable runtime environment, the 1.4.x Node.js chaincode modules and 2.x Node.js chaincode modules can be used to communicate with a Fabric 2.x or 1.4.x Peer - with the level of functionality that is implied by the Fabric version in use. 
68+
Subject to a suitable runtime environment, the 1.4.x Node.js chaincode modules and 2.x Node.js chaincode modules can be used to communicate with a Fabric 2.x or 1.4.x Peer - with the level of functionality that is implied by the Fabric version in use.

docker/fabric-nodeenv/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
#
5-
FROM node:20-alpine
5+
ARG NODE_IMAGE_TAG=22-alpine
6+
FROM node:${NODE_IMAGE_TAG}
67
RUN apk add --no-cache \
78
make \
89
python3 \
9-
g++;
10+
g++
1011
RUN mkdir -p /chaincode/input \
1112
&& mkdir -p /chaincode/output \
12-
&& mkdir -p /usr/local/src;
13+
&& mkdir -p /usr/local/src
1314
ADD build.sh start.sh /chaincode/

docker/fabric-nodeenv/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ INPUT_DIR=/chaincode/input
77
OUTPUT_DIR=/chaincode/output
88
cp -R ${INPUT_DIR}/src/. ${OUTPUT_DIR}
99
cd ${OUTPUT_DIR}
10-
if [ -f package-lock.json -o -f npm-shrinkwrap.json ]; then
11-
npm ci --only=production
10+
if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then
11+
npm ci --omit=dev
1212
else
13-
npm install --production
14-
fi
13+
npm install --omit=dev
14+
fi

0 commit comments

Comments
 (0)