Using these excellent guides
- Install an external library with docker compose - #3 by Ed_P
- The definitive guide to custom NPM modules for self-hosted instances
I was able to get this working.
dockerfile
ARG tag=latest
FROM docker.n8n.io/n8nio/n8n:$tag
USER root
RUN npm install -g maxmind
USER node
docker compose
set NODE_FUNCTION_ALLOW_EXTERNAL variable
Demo workflow to use MMDBs
Workflow to fetch MMDBs and save to /var/tmp (which obviously needs to be run before the workflow above)
Command to sanity check the files were downloaded
docker exec -it n8n-n8n-1 ls -l /var/tmp