From 17047d0b7e21e9af4f2fbbbe1635697ebcb80518 Mon Sep 17 00:00:00 2001 From: SashkoMarchuk Date: Wed, 27 Aug 2025 14:52:36 +0200 Subject: [PATCH 1/4] Update Dockerfile.n8n to install additional npm packages for markdown processing - Added installation of and npm packages to enhance markdown processing capabilities. - Set NODE_PATH environment variable for global module access. - Updated the Dockerfile to ensure all necessary packages are included for the n8n service. These changes improve the functionality of the n8n service by enabling better markdown handling. --- Dockerfile.n8n | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile.n8n b/Dockerfile.n8n index f60e55a..7e2b8ec 100644 --- a/Dockerfile.n8n +++ b/Dockerfile.n8n @@ -3,10 +3,17 @@ FROM n8nio/n8n:1.89.2 # Define build arguments ARG NODE_ENV=production ARG N8N_PORT=5678 +ARG SHOWDOWN_VERSION=^2.1.0 +ARG SLACKIFY_MARKDOWN_VERSION=^4.5.0 -# Install git for backup script +# Install git for backup script and other packages USER root RUN apk add --no-cache git=2.47.3-r0 +RUN npm install -g showdown@${SHOWDOWN_VERSION} slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} && \ + npm cache clean --force + +# Set NODE_PATH for global module access +ENV NODE_PATH=/usr/local/lib/node_modules # Create app directory WORKDIR /home/node From 4781e6324bbc5208bb3c34c9eeea8fec40d40b18 Mon Sep 17 00:00:00 2001 From: SashkoMarchuk Date: Wed, 27 Aug 2025 15:44:06 +0200 Subject: [PATCH 2/4] Update Dockerfile.n8n to configure external modules allowlist - Removed NODE_PATH environment variable and replaced it with N8N_EXTERNAL_MODULES_ALLOWLIST to specify allowed external modules for n8n. - This change enhances the security and modularity of the n8n service by explicitly defining which external modules can be used. These updates improve the configuration of the n8n service, ensuring better control over external dependencies. --- Dockerfile.n8n | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.n8n b/Dockerfile.n8n index 7e2b8ec..8e98752 100644 --- a/Dockerfile.n8n +++ b/Dockerfile.n8n @@ -12,8 +12,8 @@ RUN apk add --no-cache git=2.47.3-r0 RUN npm install -g showdown@${SHOWDOWN_VERSION} slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} && \ npm cache clean --force -# Set NODE_PATH for global module access -ENV NODE_PATH=/usr/local/lib/node_modules +# Configure n8n external modules allowlist +ENV N8N_EXTERNAL_MODULES_ALLOWLIST="showdown,slackify-markdown" # Create app directory WORKDIR /home/node From 9404ae8b1ffba4444e33ea7f6a85a56edcbc82db Mon Sep 17 00:00:00 2001 From: SashkoMarchuk Date: Wed, 27 Aug 2025 15:44:57 +0200 Subject: [PATCH 3/4] Update Dockerfile.n8n to optimize npm package installation - Modified the npm install command to include flags for ignoring scripts, audits, and funding, improving the installation process for showdown and slackify-markdown packages. - This change enhances the efficiency of the Docker build process while maintaining the necessary functionality for n8n. These updates streamline the Dockerfile configuration, ensuring a cleaner and more efficient setup for the n8n service. --- Dockerfile.n8n | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.n8n b/Dockerfile.n8n index 8e98752..d76b112 100644 --- a/Dockerfile.n8n +++ b/Dockerfile.n8n @@ -9,8 +9,10 @@ ARG SLACKIFY_MARKDOWN_VERSION=^4.5.0 # Install git for backup script and other packages USER root RUN apk add --no-cache git=2.47.3-r0 -RUN npm install -g showdown@${SHOWDOWN_VERSION} slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} && \ - npm cache clean --force +RUN npm install -g --ignore-scripts --no-audit --no-fund \ + showdown@${SHOWDOWN_VERSION} \ + slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} \ + && npm cache clean --force # Configure n8n external modules allowlist ENV N8N_EXTERNAL_MODULES_ALLOWLIST="showdown,slackify-markdown" From 3dd9c810da13f410d2e1f78952d885bc1f22530c Mon Sep 17 00:00:00 2001 From: SashkoMarchuk Date: Wed, 27 Aug 2025 16:01:17 +0200 Subject: [PATCH 4/4] Update Dockerfile.n8n to improve npm package installation and directory setup - Created a dedicated n8n data directory and modified the npm install command to install packages locally, ensuring proper ownership and organization. - This change enhances the Docker build process by streamlining package management and maintaining a clean environment for n8n. These updates contribute to a more efficient and organized setup for the n8n service. --- Dockerfile.n8n | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile.n8n b/Dockerfile.n8n index d76b112..1b465b1 100644 --- a/Dockerfile.n8n +++ b/Dockerfile.n8n @@ -9,10 +9,14 @@ ARG SLACKIFY_MARKDOWN_VERSION=^4.5.0 # Install git for backup script and other packages USER root RUN apk add --no-cache git=2.47.3-r0 -RUN npm install -g --ignore-scripts --no-audit --no-fund \ + +# Create n8n data directory and install packages locally +RUN mkdir -p /home/node/.n8n && \ + npm install --no-audit --no-fund --ignore-scripts --prefix /home/node/.n8n \ showdown@${SHOWDOWN_VERSION} \ - slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} \ - && npm cache clean --force + slackify-markdown@${SLACKIFY_MARKDOWN_VERSION} && \ + npm cache clean --force && \ + chown -R node:node /home/node/.n8n # Configure n8n external modules allowlist ENV N8N_EXTERNAL_MODULES_ALLOWLIST="showdown,slackify-markdown"