n8n / Dockerfile
Shadman9416's picture
Add: N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE
a66c192 verified
FROM node:24-alpine
USER root
# Install system dependencies required for building native modules and running n8n
RUN apk add --no-cache \
git \
python3 \
py3-pip \
make \
g++ \
build-base \
libc6-compat \
cairo-dev \
pango-dev \
chromium \
postgresql-client \
ffmpeg \
yt-dlp
# Set environment variables
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV DB_PING_INTERVAL_SECONDS=300
ENV DB_POSTGRESDB_CONNECTION_TIMEOUT=60000
ENV DB_POSTGRESDB_IDLE_CONNECTION_TIMEOUT=10000
# --- Aggressive Execution Pruning ---
ENV EXECUTIONS_DATA_PRUNE=true
ENV EXECUTIONS_DATA_MAX_AGE=48
ENV EXECUTIONS_DATA_SAVE_ON_ERROR=all
ENV EXECUTIONS_DATA_SAVE_FOR_SUCCESSFUL_QUERIES=none
# --- Bypass Supabase for Videos ---
ENV N8N_DEFAULT_BINARY_DATA_MODE=filesystem
ENV N8N_STORAGE_PATH=/data/binaryData
ENV N8N_HOST=0.0.0.0
ENV N8N_PORT=7860
ENV N8N_PROTOCOL=https
ENV GENERIC_TIMEZONE=UTC
ENV WEBHOOK_URL=https://shadman9416-n8n.hf.space/
ENV NODE_FUNCTION_ALLOW_BUILTIN=*
ENV NODE_FUNCTION_ALLOW_EXTERNAL=*
ENV N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
# Install n8n globally
RUN npm install -g n8n
# Build n8n-nodes-nim from source following official documentation [1]
# 1. Clone specific version (1.0.2)
RUN git clone --branch 1.0.2 --depth 1 https://github.com/wnger/n8n-nodes-nim.git /tmp/n8n-nodes-nim
WORKDIR /tmp/n8n-nodes-nim
# 2. Install dependencies and build
RUN npm i && npm run build && npm link
# 3. Create custom directory and link the node (as per docs [1])
RUN mkdir -p /root/.n8n/custom && cd /root/.n8n/custom && npm link n8n-nodes-nim
# Ensure proper permissions for Hugging Face Spaces
RUN chmod -R 777 /root/.n8n
# Set working directory for n8n runtime
WORKDIR /data
CMD ["n8n", "start"]