Dtneo
1
Hi,
I past few days on docker (dockerfile, compose …)
I clearly give my solution without optimisation/pretention to work better, but for me, I guess it is
I had a error “npm run build”, seems to be du to an update on node, since Latest commit [0799ff2] (but not sure).
So I prefer to use node:lts version
Dockerfile
FROM node:lts-stretch-slim
RUN apt-get update && \
apt-get -y install graphicsmagick gosu git && \
npm install -g npm@latest && \
npm_config_user=root npm install -g lerna
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/node
RUN git clone https://github.com/n8n-io/n8n.git
WORKDIR /home/node/n8n
RUN npm install --production --loglevel notice
RUN lerna bootstrap --hoist -- --production
RUN npm run build
CMD ./packages/cli/bin/n8n
EXPOSE 5678/tcp
docker-compose.yml
services:
appn8n:
image: n8ncustom
ports:
- 5678:5678
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_PORT=5678
- NODE_ENV=production
volumes:
- "./.n8n/:/root/.n8n/"
- "./packages/nodes-base/package.json:/home/node/n8n/packages/nodes-base/package.json"
# Your new nodes - add folder
# - "./packages/nodes-base/nodes:/home/node/n8n/packages/nodes-base/nodes"
# - "./packages/nodes-base/credentials:/home/node/n8n/packages/nodes-base/credentials"
# - "./packages/nodes-base/nodes:/home/node/n8n/packages/nodes-base/nodes"
# - "./packages/nodes-base/credentials:/home/node/n8n/packages/nodes-base/credentials"
Have a good day
EDIT : I made update on volume and user. Hope it’s better
2 Likes
Dtneo
2
Update on both files.
Dockerfile
FROM node:lts-stretch-slim
RUN apt-get update && \
apt-get -y install graphicsmagick gosu git && \
npm install -g npm@latest && \
npm_config_user=root npm install -g lerna
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/node
RUN git clone https://github.com/n8n-io/n8n.git
WORKDIR /home/node/n8n
RUN npm install --production --loglevel notice
RUN lerna bootstrap --hoist -- --production
RUN npm run build
CMD ls -all /home/node/n8n/packages/nodes-base/nodes/ && \
lerna bootstrap --hoist && \
npm run build && \
./packages/cli/bin/n8n
EXPOSE 5678/tcp
Docker-compose
services:
appn8n:
image: n8ncustom
ports:
- 5678:5678
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_PORT=5678
- NODE_ENV=production
- GENERIC_TIMEZONE
volumes:
- "./.n8n/:/root/.n8n/"
- "./packages/nodes-base/package.json:/home/node/n8n/packages/nodes-base/package.json"
- "./packages/nodes-base/nodes/Qonto/:/home/node/n8n/packages/nodes-base/nodes/Qonto/"
- "./packages/nodes-base/credentials/Qonto/:/home/node/n8n/packages/nodes-base/credentials/Qonto/"
You can see that I work for add the node Qonto.
Dtneo
4
news, with last node version (16.14), et n8n version 0.166.0
Dockerfile
FROM node:16.14.0-buster-slim
RUN apt-get update && \
apt-get -y install graphicsmagick gosu git
RUN npm install -g [email protected] && \
npm_config_user=root npm install -g lerna && \
npm config set legacy-peer-deps true
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/node
RUN git clone https://github.com/n8n-io/n8n.git --single-branch --branch [email protected]
WORKDIR /home/node/n8n
RUN rm -rf node_modules packages/*/node_modules packages/*/dist
RUN npm install --production --loglevel notice && \
lerna bootstrap --hoist -- --production && \
npm run build
CMD echo "192.168.1.1 rc.test.lan" >> /etc/hosts && \ # Rocketchat docker in my IP
echo "192.168.1.1 shop.test.lan" >> /etc/hosts && \ # Magento docker in my IP
ls -all /home/node/n8n/packages/nodes-base/nodes/ && \
lerna bootstrap --hoist && \
npm run build && \
./packages/cli/bin/n8n
EXPOSE 5678/tcp
docker-compose
services:
appn8n:
image: n8ncustom
restart: unless-stopped
ports:
- 5678:5678
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_PORT=5678
- NODE_ENV=production
- GENERIC_TIMEZONE
- N8N_HOST=n8n.test.lan
- N8N_USE_DEPRECATED_REQUEST_LIB=true
volumes:
- "./.n8n/:/root/.n8n/"
- "./packages/nodes-base/package.json:/home/node/n8n/packages/nodes-base/package.json"
- "./packages/nodes-base/nodes/Qonto/:/home/node/n8n/packages/nodes-base/nodes/Qonto/"
- "./packages/nodes-base/credentials/QontoApi.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/QontoApi.credentials.ts"
- "./packages/nodes-base/credentials/QontoOAuth2Api.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/QontoOAuth2Api.credentials.ts"
- "./packages/nodes-base/nodes/Axelor/:/home/node/n8n/packages/nodes-base/nodes/Axelor/"
- "./packages/nodes-base/credentials/AxelorApi.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/AxelorApi.credentials.ts"
- "./packages/nodes-base/nodes/Gls/:/home/node/n8n/packages/nodes-base/nodes/Gls/"
- "./packages/nodes-base/credentials/GlsApi.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/GlsApi.credentials.ts"
- "./packages/nodes-base/nodes/Akeneo/:/home/node/n8n/packages/nodes-base/nodes/Akeneo/"
- "./packages/nodes-base/credentials/AkeneoApi.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/AkeneoApi.credentials.ts"
1 Like
Dtneo
5
I have a loop when this error happen : “n8n-appn8n-1 exited with code 1”
I come back with Node version 14.19.
Dtneo
6
DOCKERFILE
FROM node:16.14.0-buster-slim
RUN apt-get update && \
apt-get -y install graphicsmagick gosu git curl
RUN npm install -g [email protected] && \
npm_config_user=root npm install -g lerna && \
npm config set legacy-peer-deps true
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
WORKDIR /home/node
RUN git clone https://github.com/n8n-io/n8n.git --single-branch --branch [email protected]
WORKDIR /home/node/n8n
RUN npm install --production --loglevel notice && \
lerna bootstrap --hoist -- --production && \
npm run build
CMD lerna bootstrap --hoist && \
npm run build && \
./packages/cli/bin/n8n
EXPOSE 5678/tcp
docker-compose.yml
services:
appn8n:
image: myown/n8n
restart: unless-stopped
ports:
- 5678:5678
environment:
- N8N_BASIC_AUTH_ACTIVE
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- NODE_ENV
- GENERIC_TIMEZONE
- N8N_HOST
- N8N_LOG_LEVEL
- DB_TYPE
- DB_MYSQLDB_DATABASE
- DB_MYSQLDB_HOST
- DB_MYSQLDB_PORT
- DB_MYSQLDB_USER
- DB_MYSQLDB_PASSWORD
volumes:
- "./.n8n/:/root/.n8n/"
- "./packages/nodes-base/package.json:/home/node/n8n/packages/nodes-base/package.json"
- "./packages/nodes-base/nodes/Qonto/:/home/node/n8n/packages/nodes-base/nodes/Qonto/"
- "./packages/nodes-base/credentials/QontoApi.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/QontoApi.credentials.ts"
- "./packages/nodes-base/credentials/QontoOAuth2Api.credentials.ts:/home/node/n8n/packages/nodes-base/credentials/QontoOAuth2Api.credentials.ts"
1 Like