Problem
I have set up a custom node and I’m now trying to deploy into a docker container I have, but first I’m setting up locally to see if everything works just fine. Locally, via n8n start, using npm, everything works just fine and I’ve been able to develop my action nodes quite well for the past few months. But after replicating the folders and copying everything into my container, I’m
still not being able to find my node.
There aren’t any errors as I am able to build and run docker compose up with success and then access n8n on my browser.
Dockerfile
ARG N8N_VERSION=1.47.3
RUN apk add --no-cache python3 py3-pip \
&& apk add --no-cache graphicsmagick tzdata git tini su-exec \
&& apk add --update --virtual build-dependencies python3 build-base ca-certificates \
&& npm install -g full-icu n8n@$N8N_VERSION \
&& apk del build-dependencies \
&& rm -rf /root /tmp/* /var/cache/apk/* \
&& mkdir /root
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/.n8n/custom/n8n-node
EXPOSE 5678
COPY . .
WORKDIR /home/.n8n/custom/n8n-node/nodes/mynode
RUN npm link
WORKDIR /home/.n8n/custom/n8n-node
RUN npm link custom-n8n-node
RUN npm install \
#&& npm i --dev [email protected] @types/[email protected] @types/[email protected] gulp @types/tmp @types/express n8n-workflow n8n-core gulp-typescript @types/jest \
&& npm run build
CMD ["n8n", "start"]```
FROM node:20-alpine
ARG N8N_VERSION=1.47.3
RUN apk add --no-cache python3 py3-pip \
&& apk add --no-cache graphicsmagick tzdata git tini su-exec \
&& apk add --update --virtual build-dependencies python3 build-base ca-certificates \
&& npm install -g full-icu n8n@$N8N_VERSION \
&& apk del build-dependencies \
&& rm -rf /root /tmp/* /var/cache/apk/* \
&& mkdir /root
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/.n8n/custom/unbabel-n8n-node
EXPOSE 5678
COPY . .
WORKDIR /home/.n8n/custom/unbabel-n8n-node/nodes/unbabel
# Create a local symlink for the custom node package
RUN npm link
WORKDIR /home/.n8n/custom/unbabel-n8n-node
RUN npm link n8n-nodes-unbabel
RUN npm install \
#&& npm i --dev [email protected] @types/[email protected] @types/[email protected] gulp @types/tmp @types/express n8n-workflow n8n-core gulp-typescript @types/jest \
&& npm run build
CMD ["n8n", "start"]
docker-compose.yml
version: "3.9"
x-env: &environment
environment:
N8N_TEMPLATES_ENABLED: "false"
# Basic auth credentials
N8N_ENCRYPTION_KEY: "s4p3rs3cr3t"
GENERIC_TIMEZONE: "Europe/Lisbon"
NODE_ENV: "development"
# List of external modules
NODE_FUNCTION_ALLOW_EXTERNAL: "axios,jwt-decode,tempy,tmp,dotenv,gulp,n8n,n8n-core,n8n-workflow"
# Increase node max memory
NODE_OPTIONS: "--max_old_space_size=1024"
# Set n8n to work as single thread instead of forking to worker threads
EXECUTIONS_PROCESS: "main"
services:
app:
<<: *environment
build: .
volumes:
- .:/home/node/.n8n/custom
ports:
- "5678:5678"
command: n8n start
- n8n version: N8N 1.47.3 (same I am running locally)
- Running Via - Docker compose on MACOS (M2)
- I don’t have a DB
I’m thinking the problem is with where I’m copying the files into my image.
Any help would be appreciated. Thank you