How to build own image with custom node modules?

Hey everyone!

hint, how to correctly prepare dockerfile for custom modules version 1 ?
my Dockerfile:

FROM n8nio/n8n
USER root
RUN apk --no-cache add python3 ffmpeg imagemagick-dev imagemagick py3-pip
RUN npm install -g bcrypt body-parser fcm-push
#RUN mkdir -p /root/.n8n/nodes && cd /root/.n8n/nodes && npm link bcrypt body-parser fcm-push 

The line with one of the attempts to place the link in ~/.n8n/nodes is commented out, but at the time of building the image there is no .n8n folder in it yet and after starting the image it is empty - after which of course the n8n itself does not start. hint how to build for version 1 correctly ?

Hi @brewoutlay, I am very sorry you’re having trouble!

In general, I think you can even leave out the final line and should be good, seeing you’re installing the modules globally anyway.

I just tested the below Dockerfile:

FROM n8nio/n8n:1.1.1
USER root
RUN npm install -g hello-world-npm

This works fine in the Code node:

Seeing you your n8n instance doesn’t start, perhaps you can share your server log to see which error exactly it is throwing?

1 Like

I’m ashamed to admit it, but I just forgot to specify in env the permission to run third-party modules :woozy_face:

CleanShot 2023-08-01 at 18.39.12


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.