From 39b462b0be49c0388b130c8168ff504fcb5e88d1 Mon Sep 17 00:00:00 2001 From: MiV1N <111258029+MiV1N@users.noreply.github.com> Date: Fri, 29 Dec 2023 17:17:26 +0800 Subject: [PATCH 1/4] Fix the issue of n8n not recognizing the "n8n-nodes-python" package. --- images/n8n/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/n8n/Dockerfile b/images/n8n/Dockerfile index 024c310..38e36bf 100644 --- a/images/n8n/Dockerfile +++ b/images/n8n/Dockerfile @@ -22,7 +22,7 @@ RUN apk --update add --virtual build-dependencies build-base ca-certificates && && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root; # Install n8n-nodes-python module -RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-python +RUN cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python # Install fonts RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ From 248de8c4feefd222fe00774af6083bdd2698b2e0 Mon Sep 17 00:00:00 2001 From: MiV1N <111258029+MiV1N@users.noreply.github.com> Date: Fri, 29 Dec 2023 17:46:30 +0800 Subject: [PATCH 2/4] fix can't cd to /home/node/.n8n/nodes/: No such file or directory --- images/n8n/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/n8n/Dockerfile b/images/n8n/Dockerfile index 38e36bf..1688021 100644 --- a/images/n8n/Dockerfile +++ b/images/n8n/Dockerfile @@ -22,7 +22,7 @@ RUN apk --update add --virtual build-dependencies build-base ca-certificates && && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root; # Install n8n-nodes-python module -RUN cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python +RUN mkdir -p /home/node/.n8n/nodes/ && cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python # Install fonts RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ From e52348c4fbd5f2ef3162e2c045a6cc476778534c Mon Sep 17 00:00:00 2001 From: MiV1N <111258029+MiV1N@users.noreply.github.com> Date: Fri, 29 Dec 2023 10:10:14 +0000 Subject: [PATCH 3/4] Fix the issue of n8n-debian not recognizing the "n8n-nodes-python" package. --- images/n8n-debian/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/n8n-debian/Dockerfile b/images/n8n-debian/Dockerfile index 48a5a02..207685f 100644 --- a/images/n8n-debian/Dockerfile +++ b/images/n8n-debian/Dockerfile @@ -24,7 +24,7 @@ USER root RUN npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} # Install n8n-nodes-python module -RUN cd /usr/lib/node_modules/n8n && npm install n8n-nodes-python +RUN mkdir -p /home/node/.n8n/nodes/ && cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python ENV NODE_ICU_DATA /usr/lib/node_modules/full-icu From 286c98ea07e0d885d69ee88f1030f417871d8de3 Mon Sep 17 00:00:00 2001 From: mico Date: Wed, 3 Jan 2024 10:12:07 +0000 Subject: [PATCH 4/4] Support mounting external paths to /home/node/.n8n --- images/n8n-debian/Dockerfile | 2 +- images/n8n-debian/docker-entrypoint.sh | 10 ++++++---- images/n8n/Dockerfile | 2 +- images/n8n/docker-entrypoint.sh | 8 ++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/images/n8n-debian/Dockerfile b/images/n8n-debian/Dockerfile index 207685f..4777970 100644 --- a/images/n8n-debian/Dockerfile +++ b/images/n8n-debian/Dockerfile @@ -24,7 +24,7 @@ USER root RUN npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} # Install n8n-nodes-python module -RUN mkdir -p /home/node/.n8n/nodes/ && cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python +RUN npm install n8n-nodes-python --prefix /home/node/custom/.n8n/nodes/ && mkdir /home/node/.n8n ENV NODE_ICU_DATA /usr/lib/node_modules/full-icu diff --git a/images/n8n-debian/docker-entrypoint.sh b/images/n8n-debian/docker-entrypoint.sh index 80a252f..b9dfa2b 100755 --- a/images/n8n-debian/docker-entrypoint.sh +++ b/images/n8n-debian/docker-entrypoint.sh @@ -1,11 +1,13 @@ #!/bin/sh -if [ -d /root/.n8n ] ; then - chmod o+rx /root - chown -R node /root/.n8n - ln -s /root/.n8n /home/node/ +if [ -d /home/node/custom/.n8n/nodes/ ] ; then + chmod o+rx /home/node/custom + chown -R node /home/node/custom/.n8n/ + ln -s /home/node/custom/.n8n/nodes/ /home/node/.n8n/ fi +chown -R node /home/node + if [ "$#" -gt 0 ]; then # Got started with arguments exec gosu node "$@" diff --git a/images/n8n/Dockerfile b/images/n8n/Dockerfile index 1688021..46d39b3 100644 --- a/images/n8n/Dockerfile +++ b/images/n8n/Dockerfile @@ -22,7 +22,7 @@ RUN apk --update add --virtual build-dependencies build-base ca-certificates && && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root; # Install n8n-nodes-python module -RUN mkdir -p /home/node/.n8n/nodes/ && cd /home/node/.n8n/nodes/ && npm install n8n-nodes-python +RUN npm install n8n-nodes-python --prefix /home/node/custom/.n8n/nodes/ && mkdir /home/node/.n8n # Install fonts RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \ diff --git a/images/n8n/docker-entrypoint.sh b/images/n8n/docker-entrypoint.sh index fa81b37..e9de4fd 100755 --- a/images/n8n/docker-entrypoint.sh +++ b/images/n8n/docker-entrypoint.sh @@ -1,9 +1,9 @@ #!/bin/sh -if [ -d /root/.n8n ] ; then - chmod o+rx /root - chown -R node /root/.n8n - ln -s /root/.n8n /home/node/ +if [ -d /home/node/custom/.n8n/nodes/ ] ; then + chmod o+rx /home/node/custom + chown -R node /home/node/custom/.n8n/ + ln -s /home/node/custom/.n8n/nodes/ /home/node/.n8n/ fi chown -R node /home/node