File size: 1,344 Bytes
3614979 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
FROM node:24-alpine
# Set user to root for installation
USER root
# Arguments that can be passed at build time
ARG N8N_PATH=/usr/local/lib/node_modules/n8n
ARG BASE_PATH=/root/.n8n
ARG DATABASE_PATH=$BASE_PATH/database
ARG CONFIG_PATH=$BASE_PATH/config
ARG WORKFLOWS_PATH=$BASE_PATH/workflows
ARG LOGS_PATH=$BASE_PATH/logs
# Install system dependencies (for Web automation, databases, video processing)
RUN apk add --no-cache \
git \
python3 \
py3-pip \
make \
g++ \
build-base \
cairo-dev \
pango-dev \
chromium \
postgresql-client \
ffmpeg \
yt-dlp \
openssl \
busybox-extras \
curl \
bash \
unzip \
libaio
# Puppeteer/Chromium configuration
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
# Install n8n globally (will install the latest stable version)
RUN npm install -g n8n
# Create necessary directories
RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH
# Set ownership to the 'node' user for security
RUN chown -R node:node $BASE_PATH
# Set owner and fix write permission for the working directory
RUN mkdir -p /data \
&& chown -R node:node /data
# Set working directory
WORKDIR /data
# Switch to non-root user for execution (CRITICAL FOR SECURITY)
USER node
# Start n8n
CMD ["n8n", "start"] |