Skip to content

Instantly share code, notes, and snippets.

@StancuFlorin
Last active June 19, 2025 09:01
Show Gist options
  • Save StancuFlorin/6f5e81d6400ab038c5732e02436b3311 to your computer and use it in GitHub Desktop.
Save StancuFlorin/6f5e81d6400ab038c5732e02436b3311 to your computer and use it in GitHub Desktop.
n8n

n8n

A custom Docker image for n8n that enables the execution of external Python scripts.

To use, add your .py scripts to the python-scripts directory before building and running the container.

Ensure any required Python libraries are listed in python-scripts/requirements.txt before building the image.

The scripts are executed in n8n using the execute command block with the following command

python /home/node/python-scripts/your-script.py
version: '3.8'
services:
n8n:
pull_policy: build
build:
context: .
dockerfile: Dockerfile
container_name: n8n
restart: always
environment:
- N8N_SECURE_COOKIE=false
- GENERIC_TIMEZONE=Europe/Bucharest
ports:
- "5678:5678"
labels:
net.unraid.docker.webui: 'http://[IP]:[PORT:5678]'
net.unraid.docker.icon: 'https://avatars.githubusercontent.com/u/45487711'
volumes:
- /mnt/data/appdata/n8n:/home/node/.n8n
FROM n8nio/n8n
USER root
RUN apk add --update python3 py3-pip py3-fire
USER node
COPY ./python-scripts/ /home/node/python-scripts/
RUN pip3 install -r /home/node/python-scripts/requirements.txt --break-system-packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment