I’m not sure the canonical way to do it. But we build our own docker image based on these instructions N8n-node-dev build issue with a file - #10 by jan
E.g. your run command might be
RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-text-manipulation