N8n / Dockerfile
xTHExBEASTx's picture
Update Dockerfile
c0f5392 verified
FROM node:20-bullseye
USER root
# Install Python and other dependencies
RUN apt-get update && \
apt-get install -y python3 python3-pip python3-venv && \
rm -rf /var/lib/apt/lists/*
# Create node user (similar to n8n image)
RUN groupadd -g 1000 node || true && \
useradd -u 1000 -g 1000 -d /home/node -m node || true
# Install n8n globally
RUN npm install -g n8n@2.7.4
# Create Python virtual environment for n8n
RUN python3 -m venv /home/node/.n8n/venv && \
/home/node/.n8n/venv/bin/pip install --upgrade pip && \
/home/node/.n8n/venv/bin/pip install gradio_client
# Set ownership
RUN chown -R node:node /home/node
# Environment variables
ENV N8N_PROTOCOL=https
ENV N8N_PORT=7860
ENV N8N_HOST=0.0.0.0
ENV WEBHOOK_URL=https://xthexbeastx-n8n.hf.space/
ENV N8N_EDITOR_BASE_URL=https://xthexbeastx-n8n.hf.space/
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
ENV N8N_SECURE_COOKIE=false
ENV N8N_RUNNERS_PYTHON_PATH=/home/node/.n8n/venv/bin/python
USER node
EXPOSE 7860
CMD ["n8n", "start"]