FROM nikolaik/python-nodejs:python3.12-nodejs20 ENV VIRTUAL_ENV=/venv \ PATH="/venv/bin:$PATH" \ N8N_HOST=0.0.0.0 \ N8N_PORT=7860 \ N8N_PROTOCOL=https \ #N8N_RUNNERS_ENABLED=true \ WEBHOOK_URL=https://r1000-nai.hf.space \ GENERIC_TIMEZONE=Asia/Bangkok \ NODES_EXCLUDE="[]" # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ bash sudo curl wget git w3m tzdata poppler-utils fontconfig \ unzip \ libglib2.0-0 libnss3 libfontconfig1 libxcomposite1 libxcursor1 \ libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \ libxss1 libxtst6 libatk1.0-0 libatk-bridge2.0-0 \ libpangocairo-1.0-0 libgtk-3-0 libgbm-dev libasound2 libsecret-1-0 \ && ln -snf /usr/share/zoneinfo/$GENERIC_TIMEZONE /etc/localtime \ && echo $GENERIC_TIMEZONE > /etc/timezone \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Create Python virtual environment RUN python3 -m venv $VIRTUAL_ENV \ && $VIRTUAL_ENV/bin/pip install --no-cache-dir --upgrade pip # Install Playwright with dependencies RUN $VIRTUAL_ENV/bin/pip install --no-cache-dir playwright \ && $VIRTUAL_ENV/bin/python -m playwright install --with-deps chromium # Update npm and install n8n (use stable version instead of beta to avoid build issues) RUN npm install -g npm@latest \ && npm install -g n8n --unsafe-perm \ && npm cache clean --force # Create non-root user and data directory # RUN useradd -m nodeuser \ # && mkdir -p /data/.n8n \ # && chown -R nodeuser:nodeuser /data # Switch to non-root user # USER nodeuser WORKDIR /data VOLUME ["/data/.n8n"] EXPOSE 7860 CMD ["n8n"]