# Start from a standard Fedora base image FROM fedora:latest # Install necessary dependencies using dnf # -y flag to auto-confirm. # We need nodejs (which includes npm) and python3 with pip. RUN dnf install -y nodejs python3 python3-pip && dnf clean all # Now use npm to install n8n globally RUN npm install -g n8n # Create a non-root user 'node' for security RUN groupadd -r node && useradd -r -g node -d /home/node -m -s /bin/bash node # Create the directory for n8n's data and set permissions RUN mkdir /home/node/.n8n && \ chown -R node:node /home/node/.n8n # Switch to the non-root 'node' user USER node # Set the working directory to the n8n data directory WORKDIR /home/node/.n8n # Expose the n8n port EXPOSE 5678 # Set the default command to start n8n CMD [ "n8n" ]