Update Dockerfile
Browse files- Dockerfile +26 -17
Dockerfile
CHANGED
|
@@ -2,42 +2,51 @@ FROM continuumio/miniconda3
|
|
| 2 |
|
| 3 |
LABEL maintainer="Xiaoliang <xiaoliang.zero@gmail.com>"
|
| 4 |
|
| 5 |
-
# Set up PNPM_HOME and PATH for root
|
| 6 |
ENV PNPM_HOME="/root/.local/share/pnpm"
|
| 7 |
ENV PATH="$PNPM_HOME:/opt/conda/bin:/usr/local/bin:$PATH"
|
| 8 |
-
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
| 9 |
|
| 10 |
-
# Install mamba, tini, nodejs
|
| 11 |
RUN conda install -y -c conda-forge mamba tini && \
|
| 12 |
-
mamba install -y -c conda-forge
|
| 13 |
npm install -g pnpm
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
RUN mkdir -p /ms-playwright && chmod -R 0777 /ms-playwright
|
| 17 |
-
|
| 18 |
-
# Create the global pnpm dir for root, configure pnpm to use it, and install playwright globally
|
| 19 |
RUN mkdir -p $PNPM_HOME && \
|
| 20 |
pnpm config set global-bin-dir $PNPM_HOME && \
|
| 21 |
-
|
| 22 |
|
| 23 |
-
# Install
|
| 24 |
-
RUN playwright install --with-deps
|
| 25 |
|
| 26 |
-
# Create
|
| 27 |
RUN useradd -m n8nuser
|
| 28 |
|
| 29 |
-
# Set up PNPM_HOME, PATH, and browser path for the non-root user
|
| 30 |
USER n8nuser
|
| 31 |
WORKDIR /home/n8nuser
|
|
|
|
|
|
|
| 32 |
ENV PNPM_HOME="/home/n8nuser/.local/share/pnpm"
|
| 33 |
ENV PATH="$PNPM_HOME:/opt/conda/bin:/usr/local/bin:$PATH"
|
| 34 |
-
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
# Create pnpm global dir for
|
| 37 |
RUN mkdir -p $PNPM_HOME && \
|
| 38 |
pnpm config set global-bin-dir $PNPM_HOME && \
|
| 39 |
-
pnpm add -g n8n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
EXPOSE 5678
|
| 42 |
|
| 43 |
-
ENTRYPOINT ["tini", "--", "n8n"]
|
|
|
|
| 2 |
|
| 3 |
LABEL maintainer="Xiaoliang <xiaoliang.zero@gmail.com>"
|
| 4 |
|
| 5 |
+
# Set up PNPM_HOME and PATH for root, and Playwright browser location
|
| 6 |
ENV PNPM_HOME="/root/.local/share/pnpm"
|
| 7 |
ENV PATH="$PNPM_HOME:/opt/conda/bin:/usr/local/bin:$PATH"
|
| 8 |
+
ENV PLAYWRIGHT_BROWSERS_PATH="/ms-playwright"
|
| 9 |
|
| 10 |
+
# Install mamba, tini, nodejs 18, and pnpm
|
| 11 |
RUN conda install -y -c conda-forge mamba tini && \
|
| 12 |
+
mamba install -y -c conda-forge nodejs=18 && \
|
| 13 |
npm install -g pnpm
|
| 14 |
|
| 15 |
+
# Prepare global dirs for pnpm and Playwright for root
|
|
|
|
|
|
|
|
|
|
| 16 |
RUN mkdir -p $PNPM_HOME && \
|
| 17 |
pnpm config set global-bin-dir $PNPM_HOME && \
|
| 18 |
+
mkdir -p /ms-playwright && chmod 0777 /ms-playwright
|
| 19 |
|
| 20 |
+
# Install Playwright globally and its browser dependencies as root (needed for playwright install)
|
| 21 |
+
RUN pnpm add -g playwright && playwright install --with-deps
|
| 22 |
|
| 23 |
+
# Create non-root user for n8n
|
| 24 |
RUN useradd -m n8nuser
|
| 25 |
|
|
|
|
| 26 |
USER n8nuser
|
| 27 |
WORKDIR /home/n8nuser
|
| 28 |
+
|
| 29 |
+
# Set up PNPM_HOME, PATH, and Playwright browser path for n8nuser
|
| 30 |
ENV PNPM_HOME="/home/n8nuser/.local/share/pnpm"
|
| 31 |
ENV PATH="$PNPM_HOME:/opt/conda/bin:/usr/local/bin:$PATH"
|
| 32 |
+
ENV PLAYWRIGHT_BROWSERS_PATH="/ms-playwright"
|
| 33 |
+
ENV N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
|
| 34 |
+
ENV N8N_RUNNERS_ENABLED=true
|
| 35 |
|
| 36 |
+
# Create pnpm global dir for n8nuser and install n8n
|
| 37 |
RUN mkdir -p $PNPM_HOME && \
|
| 38 |
pnpm config set global-bin-dir $PNPM_HOME && \
|
| 39 |
+
pnpm add -g n8n
|
| 40 |
+
|
| 41 |
+
# Install n8n-nodes-playwright and extract into .n8n/nodes for community node compatibility
|
| 42 |
+
RUN mkdir -p /home/n8nuser/.n8n/nodes && \
|
| 43 |
+
pnpm pack n8n-nodes-playwright && \
|
| 44 |
+
tar -xzf n8n-nodes-playwright-*.tgz -C /home/n8nuser/.n8n/nodes && \
|
| 45 |
+
rm n8n-nodes-playwright-*.tgz
|
| 46 |
+
|
| 47 |
+
# (Optional but recommended) Set strict permissions for n8n config
|
| 48 |
+
RUN mkdir -p /home/n8nuser/.n8n && chmod 700 /home/n8nuser/.n8n
|
| 49 |
|
| 50 |
EXPOSE 5678
|
| 51 |
|
| 52 |
+
ENTRYPOINT ["tini", "--", "n8n"]
|