Skip to content

Commit

Permalink
Merge pull request #437 from node-red/dev
Browse files Browse the repository at this point in the history
Merge dev to master for 4.0 release
  • Loading branch information
knolleary authored Jun 20, 2024
2 parents 5ff0e3a + eb89667 commit 333c3f9
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=16
ARG NODE_VERSION=20
ARG OS=alpine

#### Stage BASE ########################################################################################################
Expand Down
4 changes: 2 additions & 2 deletions .docker/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NODE_VERSION=16
ARG OS=buster-slim
ARG NODE_VERSION=20
ARG OS=bullseye-slim

#### Stage BASE ########################################################################################################
FROM node:${NODE_VERSION}-${OS} AS base
Expand Down
34 changes: 0 additions & 34 deletions .docker/healthcheck.js

This file was deleted.

1 change: 1 addition & 0 deletions .docker/healthcheck.js
43 changes: 11 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ jobs:
alpine:
env:
# Setting the defaults up front
LATEST_NODE: 16
LATEST_NODE: 20
DEFAULT_IMAGE: nodered/node-red
DEV_IMAGE: nodered/node-red-dev
runs-on: ubuntu-latest

strategy:
matrix:
node: [14, 16, 18]
node: [18, 20, 22]
suffix: ["", "-minimal"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
-
name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.2
- name: Show Env
run: env
-
Expand All @@ -59,7 +59,8 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Get Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
# run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Get Node-RED Version
id: nrVersion
run: |
Expand Down Expand Up @@ -140,10 +141,9 @@ jobs:
name: Build and push
id: build-push
uses: docker/build-push-action@v5
continue-on-error: true
with:
context: .
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6
platforms: linux/amd64, linux/arm64
push: ${{ steps.nrVersion.outputs.push }}
file: .docker/Dockerfile.alpine
build-args: |
Expand All @@ -159,14 +159,14 @@ jobs:
debian:
env:
# Setting the defaults up front
LATEST_NODE: 16
LATEST_NODE: 20
DEFAULT_IMAGE: nodered/node-red
DEV_IMAGE: nodered/node-red-dev
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.2
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
Expand All @@ -178,7 +178,8 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
# run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%SZ')"
run : echo "date=$(date +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -237,7 +238,7 @@ jobs:
- name: Build and push
id: build-push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64, linux/arm64, linux/arm/v7
Expand All @@ -252,26 +253,4 @@ jobs:
BUILD_VERSION=${{ steps.nrVersion.outputs.buildVersion }}
tags: ${{ steps.nrVersion.outputs.tags }}

# -
# name: Sign Image
# run: |
# echo "Digest ${{ steps.build-push.outputs.digest }}"
# for TAG in $(echo "${{ steps.nrVersion.outputs.tags }}" | sed "s/,/ /g"); do
# if [[ "$TAG" == "${{ env.DEFAULT_IMAGE }}:latest" ]]; then
# export DOCKER_CONTENT_TRUST=1
# SIGNER_KEY_NAME="8b08f4d8315a5d6443a4f59eaab60a49dacbc105c13d25f167cdb5cc9fa8f9ed.key"
# PATH_KEYS=$HOME/.docker/trust/private
# mkdir -p $PATH_KEYS
# cp .docker/$SIGNER_KEY_NAME $PATH_KEYS
# chmod 600 $PATH_KEYS/$SIGNER_KEY_NAME
# export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=${{ secrets.DOCKER_SIGNING_PASSWORD }}
# docker trust key load $PATH_KEYS/$SIGNER_KEY_NAME
# # docker trust sign $TAG
# # docker trust inspect --pretty $TAG
# echo "Siging tag $TAG"
# else
# echo "Not signing $TAG"
# fi
# done


101 changes: 48 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ Let's dissect that command:
-p 1880:1880 - connect local port 1880 to the exposed internal port 1880
-v node_red_data:/data - mount the host node_red_data directory to the container /data directory so any changes made to flows are persisted
--name mynodered - give this machine a friendly local name
nodered/node-red - the image to base it on - currently Node-RED v3.1.11
nodered/node-red - the image to base it on - currently Node-RED v4.0.0



Running that command should give a terminal window with a running instance of Node-RED.

Welcome to Node-RED
===================

10 Oct 12:57:10 - [info] Node-RED version: v3.1.11
10 Oct 12:57:10 - [info] Node.js version: v16.14.1
10 Oct 12:57:10 - [info] Linux 4.19.76-linuxkit x64 LE
10 Oct 12:57:10 - [info] Node-RED version: v4.0.0
10 Oct 12:57:10 - [info] Node.js version: v18.19.0
10 Oct 12:57:10 - [info] Linux 6.6.13-100.fc38.x86_64 x64 LE
10 Oct 12:57:11 - [info] Loading palette nodes
10 Oct 12:57:16 - [info] Settings file : /data/settings.js
10 Oct 12:57:16 - [info] Context store : 'default' [module=memory]
Expand All @@ -60,7 +61,7 @@ Running that command should give a terminal window with a running instance of No

10 Oct 12:57:17 - [info] Starting flows
10 Oct 12:57:17 - [info] Started flows
10 Oct 12:57:17 - [info] Server now running at http://127.0.0.1:1880/
10 Oct 12:57:17 - [info] Server now running at http://localhost:1880/

[...]

Expand Down Expand Up @@ -114,51 +115,43 @@ The following table shows the variety of provided Node-RED images.

| **Tag** |**Node**| **Arch** | **Python** |**Dev**| **Base Image** |
|----------------------------|--------|----------|------------|-------|----------------------------|
| 3.1.11-14 | 14 | amd64 | 2.x 3.x | yes | amd64/node:14-alpine |
| | 14 | arm32v6 | 2.x 3.x | yes | arm32v6/node:14-alpine |
| | 14 | arm32v7 | 2.x 3.x | yes | arm32v7/node:14-alpine |
| | 14 | arm64v8 | 2.x 3.x | yes | arm64v8/node:14-alpine |
| | 14 | s390x | 2.x 3.x | yes | s390x/node:14-alpine |
| | 14 | i386 | 2.x 3.x | yes | i386/node:14-alpine |
| 4.0.0-18 | 18 | amd64 | 3.x | yes | amd64/node:18-alpine |
| | 18 | arm32v7 | 3.x | yes | arm32v7/node:18-alpine |
| | 18 | arm64v8 | 3.x | yes | arm64v8/node:18-alpine |
| | 18 | i386 | 3.x | yes | i386/node:18-alpine |
| | | | | | |
| 3.1.11-14-minimal | 14 | amd64 | no | no | amd64/node:14-alpine |
| | 14 | arm32v6 | no | no | arm32v6/node:14-alpine |
| | 14 | arm32v7 | no | no | arm32v7/node:14-alpine |
| | 14 | arm64v8 | no | no | arm64v8/node:14-alpine |
| | 14 | s390x | no | no | s390x/node:14-alpine |
| | 14 | i386 | no | no | i386/node:14-alpine |
| 4.0.0-18-minimal | 18 | amd64 | no | no | amd64/node:18-alpine |
| | 18 | arm32v7 | no | no | arm32v7/node:18-alpine |
| | 18 | arm64v8 | no | no | arm64v8/node:18-alpine |
| | 18 | i386 | no | no | i386/node:18-alpine |

| **Tag** |**Node**| **Arch** | **Python** |**Dev**| **Base Image** |
|----------------------------|--------|----------|------------|-------|----------------------------|
| 3.1.11-16 | 16 | amd64 | 2.x 3.x | yes | amd64/node:16-alpine |
| | 16 | arm32v6 | 2.x 3.x | yes | arm32v6/node:16-alpine |
| | 16 | arm32v7 | 2.x 3.x | yes | arm32v7/node:16-alpine |
| | 16 | arm64v8 | 2.x 3.x | yes | arm64v8/node:16-alpine |
| | 16 | s390x | 2.x 3.x | yes | s390x/node:16-alpine |
| | 16 | i386 | 2.x 3.x | yes | i386/node:16-alpine |
| 4.0.0-20 | 20 | amd64 | 3.x | yes | amd64/node:20-alpine |
| | 20 | arm32v7 | 3.x | yes | arm32v7/node:20-alpine |
| | 20 | arm64v8 | 3.x | yes | arm64v8/node:20-alpine |
| | 20 | i386 | 3.x | yes | i386/node:20-alpine |
| | | | | | |
| 4.0.0-20-minimal | 20 | amd64 | no | no | amd64/node:20-alpine |
| | 20 | arm32v7 | no | no | arm32v7/node:20-alpine |
| | 20 | arm64v8 | no | no | arm64v8/node:20-alpine |
| | 20 | i386 | no | no | i386/node:20-alpine |
| | | | | | |
| 3.1.11-16-minimal | 16 | amd64 | no | no | amd64/node:16-alpine |
| | 16 | arm32v6 | no | no | arm32v6/node:16-alpine |
| | 16 | arm32v7 | no | no | arm32v7/node:16-alpine |
| | 16 | arm64v8 | no | no | arm64v8/node:16-alpine |
| | 16 | s390x | no | no | s390x/node:16-alpine |
| | 16 | i386 | no | no | i386/node:16-alpine |
| 4.0.0-debian | 20 | amd64 | 3.x | yes | amd64/node:20-buster-slim |
| | 20 | arm32v7 | 3.x | yes | amd64/node:20-buster-slim |
| | 20 | arm64v8 | 3.x | yes | amd64/node:20-buster-slim |

| **Tag** |**Node**| **Arch** | **Python** |**Dev**| **Base Image** |
|----------------------------|--------|----------|------------|-------|----------------------------|
| 3.1.11-18 | 18 | amd64 | 2.x 3.x | yes | amd64/node:18-alpine |
| | 18 | arm32v6 | 2.x 3.x | yes | arm32v6/node:18-alpine |
| | 18 | arm32v7 | 2.x 3.x | yes | arm32v7/node:18-alpine |
| | 18 | arm64v8 | 2.x 3.x | yes | arm64v8/node:18-alpine |
| | 18 | s390x | 2.x 3.x | yes | s390x/node:18-alpine |
| | 18 | i386 | 2.x 3.x | yes | i386/node:18-alpine |
| 4.0.0-22 | 22 | amd64 | 3.x | yes | amd64/node:22-alpine |
| | 22 | arm32v7 | 3.x | yes | arm32v7/node:22-alpine |
| | 22 | arm64v8 | 3.x | yes | arm64v8/node:22-alpine |
| | 22 | i386 | 3.x | yes | i386/node:22-alpine |
| | | | | | |
| 3.1.11-18-minimal | 18 | amd64 | no | no | amd64/node:18-alpine |
| | 18 | arm32v6 | no | no | arm32v6/node:18-alpine |
| | 18 | arm32v7 | no | no | arm32v7/node:18-alpine |
| | 18 | arm64v8 | no | no | arm64v8/node:18-alpine |
| | 18 | s390x | no | no | s390x/node:18-alpine |
| | 18 | i386 | no | no | i386/node:18-alpine |
| 4.0.0-22-minimal | 22 | amd64 | no | no | amd64/node:22-alpine |
| | 22 | arm32v7 | no | no | arm32v7/node:22-alpine |
| | 22 | arm64v8 | no | no | arm64v8/node:22-alpine |
| | 22 | i386 | no | no | i386/node:22-alpine |

- All images have bash, tzdata, nano, curl, git, openssl and openssh-client pre-installed to support Node-RED's Projects feature.

Expand All @@ -167,40 +160,42 @@ The following table shows the provided Manifest Lists.

| **Tag** | **Node-RED Base Image** |
|----------------------------------------|--------------------------------------------|
| latest, 3.1.11, | nodered/node-red:3.1.11-16 |
| latest-16, 3.1.11-16 | |
| latest, 4.0.0, | nodered/node-red:4.0.0-20 |
| latest-20, 4.0.0-20 | |
| | |
| | |
| latest-minimal, 4.0.0-minimal, | nodered/node-red:4.0.0-20-minimal |
| latest-20-minimal, 4.0.0-20-minimal | |
| | |
| latest-minimal, 3.1.11-minimal, | nodered/node-red:3.1.11-16-minimal |
| latest-16-minimal, 3.1.11-16-minimal | |
| latest-debian | nodered/node-red:latest-debian |


| **Tag** | **Node-RED Base Image** |
|----------------------------------------|--------------------------------------------|
| latest-14, 3.1.11-14 | nodered/node-red:3.1.11-14 |
| latest-18, 4.0.0-18 | nodered/node-red:4.0.0-18 |
| | |
| latest-14-minimal, 3.1.11-14-minimal | nodered/node-red:3.1.11-14-minimal |
| latest-18-minimal, 4.0.0-18-minimal | nodered/node-red:4.0.0-18-minimal |


| **Tag** | **Node-RED Base Image** |
|----------------------------------------|--------------------------------------------|
| latest-18, 3.1.11-18 | nodered/node-red:3.1.11-18 |
| latest-22, 4.0.0-22 | nodered/node-red:4.0.0-22 |
| | |
| latest-18-minimal, 3.1.11-18-minimal | nodered/node-red:3.1.11-18-minimal
| latest-22-minimal, 4.0.0-22-minimal | nodered/node-red:4.0.0-22-minimal


With the support of Docker manifest list, there is no need to explicitly add the tag for the architecture to use.
When a docker run command or docker service command or docker stack command is executed, docker checks which architecture is required and verifies if it is available in the docker repository. If it does, docker pulls the matching image for it.

Therefore all tags regarding Raspberry PI's are dropped.

For example: suppose you are running on a Raspberry PI 3B, which has `arm32v7` as architecture. Then just run the following command to pull the image (tagged by `3.1.11-16`), and run the container.
For example: suppose you are running on a Raspberry PI 3B, which has `arm32v7` as architecture. Then just run the following command to pull the image (tagged by `4.0.0-20`), and run the container.


```
docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red:latest
```

The same command can be used for running on an amd64 system, since docker discovers its running on a amd64 host and pulls the image with the matching tag (`3.1.11-16-amd64`).

This gives the advantage that you don't need to know/specify which architecture you are running on and makes docker run commands and docker compose files more flexible and exchangeable across systems.


Expand Down Expand Up @@ -334,7 +329,7 @@ Docker build process, the dependencies are installed under `/usr/src/node-red`.
The main sections to modify are

"dependencies": {
"node-red": "^3.1.11", <-- set the version of Node-RED here
"node-red": "^4.0.0", <-- set the version of Node-RED here
"node-red-dashboard": "*" <-- add any extra npm packages here
},

Expand Down
5 changes: 3 additions & 2 deletions docker-custom/Dockerfile.custom
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
ARG ARCH=amd64
ARG NODE_VERSION=16
ARG NODE_VERSION=20
ARG OS=alpine

#### Stage BASE ########################################################################################################
FROM ${ARCH}/node:${NODE_VERSION}-${OS} AS base

# Copy scripts
COPY scripts/*.sh /tmp/
COPY healthcheck.js /

# Install tools, create Node-RED app and data dir, add user and set rights
RUN set -ex && \
Expand Down Expand Up @@ -96,7 +97,7 @@ ENV NODE_RED_VERSION=$NODE_RED_VERSION \
EXPOSE 1880

# Add a healthcheck (default every 30 secs)
# HEALTHCHECK CMD curl http://localhost:1880/ || exit 1
HEALTHCHECK CMD node /healthcheck.js

# ENTRYPOINT ["npm", "start", "--cache", "/data/.npm", "--", "--userDir", "/data"]
ENTRYPOINT ["./entrypoint.sh"]
7 changes: 4 additions & 3 deletions docker-custom/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
ARG ARCH=amd64
ARG NODE_VERSION=16
ARG OS=buster-slim
ARG NODE_VERSION=20
ARG OS=bullseye-slim

#### Stage BASE ########################################################################################################
FROM ${ARCH}/node:${NODE_VERSION}-${OS} AS base

# Copy scripts
COPY scripts/*.sh /tmp/
COPY healthcheck.js /

# Install tools, create Node-RED app and data dir, add user and set rights
RUN set -ex && \
Expand Down Expand Up @@ -97,6 +98,6 @@ ENV NODE_RED_VERSION=$NODE_RED_VERSION \
EXPOSE 1880

# Add a healthcheck (default every 30 secs)
# HEALTHCHECK CMD curl http://localhost:1880/ || exit 1
HEALTHCHECK CMD node /healthcheck.js

ENTRYPOINT ["./entrypoint.sh"]
Loading

0 comments on commit 333c3f9

Please sign in to comment.