Skip to content

Commit 1c3c31a

Browse files
committed
add nodered
1 parent 36ed4a9 commit 1c3c31a

File tree

5 files changed

+123
-80
lines changed

5 files changed

+123
-80
lines changed

Dockerfile-all.template

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,70 @@ ${PARTIAL_0}
22

33
FROM sstc/headful-chromium:ubuntu-24
44
RUN set -ex; \
5-
apt update; \
6-
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
7-
tini \
8-
iputils-ping \
9-
dnsutils \
10-
rsync \
11-
curl \
12-
jq \
13-
; \
14-
# In the mean time, install all popular scripting languages
15-
# curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -; \
16-
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
17-
# nodejs \
18-
# npm \
19-
php \
20-
ruby \
21-
lua5.4 \
22-
; \
23-
bash --version; \
24-
perl --version; \
25-
# python2 --version; \
26-
python3 --version; \
27-
node -v; \
28-
npm -v; \
29-
php -v; \
30-
ruby -v; \
31-
lua -v; \
32-
apt clean; \
33-
rm -rf /var/lib/apt/lists/*
5+
apt update; \
6+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
7+
tini \
8+
iputils-ping \
9+
dnsutils \
10+
rsync \
11+
curl \
12+
jq \
13+
; \
14+
# In the mean time, install all popular scripting languages
15+
# curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -; \
16+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
17+
# nodejs \
18+
# npm \
19+
php \
20+
ruby \
21+
lua5.4 \
22+
; \
23+
bash --version; \
24+
perl --version; \
25+
# python2 --version; \
26+
python3 --version; \
27+
node -v; \
28+
npm -v; \
29+
php -v; \
30+
ruby -v; \
31+
lua -v; \
32+
apt clean; \
33+
rm -rf /var/lib/apt/lists/*
3434

3535
# https://npmtrends.com/axios-vs-got-vs-node-fetch-vs-request-vs-superagent
3636
RUN set -e; \
37-
npm -g install \
38-
node-fetch
37+
npm -g install \
38+
node-fetch
3939

40-
WORKDIR /gocron2
4140
COPY --from=builder /tmp/gocron2 /gocron2/gocron2
4241
COPY --from=builder /tmp/gocron2-node /gocron2/gocron2-node
4342
COPY --from=builder /tmp/certstrap /gocron2/certstrap
4443
COPY run-all.sh /gocron2/run-all.sh
4544
COPY init-cert.sh /gocron2/init-cert.sh
4645

47-
VOLUME [ "/gocron2/conf", "/gocron2/log", "/gocron2/out", "/app" ]
46+
# https://github.com/node-red/node-red-docker/blob/master/docker-custom/Dockerfile.debian
47+
RUN set -ex; \
48+
apt update; \
49+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
50+
bash \
51+
tzdata \
52+
curl \
53+
nano \
54+
wget \
55+
git \
56+
openssl \
57+
openssh-client \
58+
ca-certificates \
59+
;
60+
61+
RUN set -e; \
62+
npm i -g --unsafe-perm --no-update-notifier --no-fund --only=production \
63+
node-red
64+
65+
WORKDIR /app
66+
VOLUME [ "/gocron2/conf", "/gocron2/log", "/gocron2/out", "/nodered", "/app" ]
4867
EXPOSE 5920
4968
EXPOSE 5921
69+
EXPOSE 1880
5070
ENTRYPOINT ["tini", "--"]
5171
CMD ["/gocron2/run-all.sh"]

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,41 @@ docker run -d --name gocron2-node \
3838
> Multiple nodes with certs
3939
4040
```bash
41-
# Create certs for main node
41+
# Create certs for main node (we mount conf/ to out/, because certs will output to out/)
4242
docker run --rm \
43-
-v /path/to/out:/gocron2/out \
43+
-v /path/to/conf:/gocron2/out \
4444
sstc/gocron2 ./init-cert.sh
4545

4646
# Create certs for worker nodes
4747
docker run --rm \
48-
-v /path/to/out:/gocron2/out \
48+
-v /path/to/conf:/gocron2/out \
4949
sstc/gocron2 ./init-cert.sh 1.2.3.4
5050

5151
# Configure main node: add those to /path/to/conf/app.ini
5252
# enable_tls = true
53-
# ca_file = /gocron2/out/Root_CA.crt
54-
# cert_file = /gocron2/out/127.0.0.1.crt
55-
# key_file = /gocron2/out/127.0.0.1.key
53+
# ca_file = /gocron2/conf/Root_CA.crt
54+
# cert_file = /gocron2/conf/127.0.0.1.crt
55+
# key_file = /gocron2/conf/127.0.0.1.key
5656

5757
# Up main node
5858
docker run -d --name gocron2 \
5959
-v /path/to/conf:/gocron2/conf \
6060
-v /path/to/log:/gocron2/log \
61-
-v /path/to/out:/gocron2/out \
6261
-p 5920:5920 \
6362
sstc/gocron2:server
6463

65-
# Copy cert files in /path/to/out for the worker nodes
64+
# Copy cert files in /path/to/conf for the worker nodes
6665

6766
# Up all worker nodes
6867
docker run -d --name gocron2-node \
69-
-v /path/to/out:/gocron2/out \
68+
-v /path/to/conf:/gocron2/conf \
7069
-v /path/to/my-task-scripts:/app \
7170
-p 5921:5921 \
7271
sstc/gocron2 gocron2-node -allow-root \
7372
-enable-tls \
74-
-ca-file /gocron2/out/Root_CA.crt \
75-
-cert-file /gocron2/out/1.2.3.4.crt \
76-
-key-file /gocron2/out/1.2.3.4.key
73+
-ca-file /gocron2/conf/Root_CA.crt \
74+
-cert-file /gocron2/conf/1.2.3.4.crt \
75+
-key-file /gocron2/conf/1.2.3.4.key
7776

7877
# Open 127.0.0.1:5920 to install
7978
```

all/Dockerfile

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,70 @@ RUN set -ex; \
2121

2222
FROM sstc/headful-chromium:ubuntu-24
2323
RUN set -ex; \
24-
apt update; \
25-
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
26-
tini \
27-
iputils-ping \
28-
dnsutils \
29-
rsync \
30-
curl \
31-
jq \
32-
; \
33-
# In the mean time, install all popular scripting languages
34-
# curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -; \
35-
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
36-
# nodejs \
37-
# npm \
38-
php \
39-
ruby \
40-
lua5.4 \
41-
; \
42-
bash --version; \
43-
perl --version; \
44-
# python2 --version; \
45-
python3 --version; \
46-
node -v; \
47-
npm -v; \
48-
php -v; \
49-
ruby -v; \
50-
lua -v; \
51-
apt clean; \
52-
rm -rf /var/lib/apt/lists/*
24+
apt update; \
25+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
26+
tini \
27+
iputils-ping \
28+
dnsutils \
29+
rsync \
30+
curl \
31+
jq \
32+
; \
33+
# In the mean time, install all popular scripting languages
34+
# curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -; \
35+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
36+
# nodejs \
37+
# npm \
38+
php \
39+
ruby \
40+
lua5.4 \
41+
; \
42+
bash --version; \
43+
perl --version; \
44+
# python2 --version; \
45+
python3 --version; \
46+
node -v; \
47+
npm -v; \
48+
php -v; \
49+
ruby -v; \
50+
lua -v; \
51+
apt clean; \
52+
rm -rf /var/lib/apt/lists/*
5353

5454
# https://npmtrends.com/axios-vs-got-vs-node-fetch-vs-request-vs-superagent
5555
RUN set -e; \
56-
npm -g install \
57-
node-fetch
56+
npm -g install \
57+
node-fetch
5858

59-
WORKDIR /gocron2
6059
COPY --from=builder /tmp/gocron2 /gocron2/gocron2
6160
COPY --from=builder /tmp/gocron2-node /gocron2/gocron2-node
6261
COPY --from=builder /tmp/certstrap /gocron2/certstrap
6362
COPY run-all.sh /gocron2/run-all.sh
6463
COPY init-cert.sh /gocron2/init-cert.sh
6564

66-
VOLUME [ "/gocron2/conf", "/gocron2/log", "/gocron2/out", "/app" ]
65+
# https://github.com/node-red/node-red-docker/blob/master/docker-custom/Dockerfile.debian
66+
RUN set -ex; \
67+
apt update; \
68+
DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y \
69+
bash \
70+
tzdata \
71+
curl \
72+
nano \
73+
wget \
74+
git \
75+
openssl \
76+
openssh-client \
77+
ca-certificates \
78+
;
79+
80+
RUN set -e; \
81+
npm i -g --unsafe-perm --no-update-notifier --no-fund --only=production \
82+
node-red
83+
84+
WORKDIR /app
85+
VOLUME [ "/gocron2/conf", "/gocron2/log", "/gocron2/out", "/nodered", "/app" ]
6786
EXPOSE 5920
6887
EXPOSE 5921
88+
EXPOSE 1880
6989
ENTRYPOINT ["tini", "--"]
7090
CMD ["/gocron2/run-all.sh"]

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#/bin/bash
2+
3+
docker build -t gocron2 -f all/Dockerfile .

run-all.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

3-
./gocron2 web &
4-
./gocron2-node -allow-root &
3+
/gocron2/gocron2 web &
4+
/gocron2/gocron2-node -allow-root &
5+
npx -g node-red --userDir /nodered &
56
wait -n
67
exit $?

0 commit comments

Comments
 (0)