Alirezamp commited on
Commit
e2011c3
·
verified ·
1 Parent(s): 480c300

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -73
Dockerfile CHANGED
@@ -1,73 +1 @@
1
- ARG NODE_VERSION=22
2
- ARG N8N_VERSION=snapshot
3
-
4
- # 1. Create an image to build n8n
5
- FROM --platform=linux/amd64 n8nio/base:${NODE_VERSION} AS builder
6
-
7
- # Build the application from source
8
- WORKDIR /src
9
- COPY . /src
10
- RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store --mount=type=cache,id=pnpm-metadata,target=/root/.cache/pnpm/metadata DOCKER_BUILD=true pnpm install --frozen-lockfile
11
- RUN pnpm build
12
-
13
- # Delete all dev dependencies
14
- RUN jq 'del(.pnpm.patchedDependencies)' package.json > package.json.tmp; mv package.json.tmp package.json
15
- RUN node .github/scripts/trim-fe-packageJson.js
16
-
17
- # Delete any source code or typings
18
- RUN find . -type f -name "*.ts" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
19
-
20
- # Deploy the `n8n` package into /compiled
21
- RUN mkdir /compiled
22
- RUN NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --no-optional --legacy deploy /compiled
23
-
24
- # 2. Start with a new clean image with just the code that is needed to run n8n
25
- FROM n8nio/base:${NODE_VERSION}
26
- ENV NODE_ENV=production
27
-
28
- ARG N8N_RELEASE_TYPE=dev
29
- ENV N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE}
30
-
31
- LABEL org.opencontainers.image.title="n8n"
32
- LABEL org.opencontainers.image.description="Workflow Automation Tool"
33
- LABEL org.opencontainers.image.source="https://github.com/n8n-io/n8n"
34
- LABEL org.opencontainers.image.url="https://n8n.io"
35
- LABEL org.opencontainers.image.version=${N8N_VERSION}
36
-
37
- WORKDIR /home/node
38
- COPY --from=builder /compiled /usr/local/lib/node_modules/n8n
39
- COPY docker-entrypoint.sh /
40
-
41
- # Setup the Task Runner Launcher
42
- ARG TARGETPLATFORM
43
- ARG LAUNCHER_VERSION=1.1.2
44
- COPY n8n-task-runners.json /etc/n8n-task-runners.json
45
- # Download, verify, then extract the launcher binary
46
- RUN \
47
- if [[ "$TARGETPLATFORM" = "linux/amd64" ]]; then export ARCH_NAME="amd64"; \
48
- elif [[ "$TARGETPLATFORM" = "linux/arm64" ]]; then export ARCH_NAME="arm64"; fi; \
49
- mkdir /launcher-temp && \
50
- cd /launcher-temp && \
51
- wget https://github.com/n8n-io/task-runner-launcher/releases/download/${LAUNCHER_VERSION}/task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz && \
52
- wget https://github.com/n8n-io/task-runner-launcher/releases/download/${LAUNCHER_VERSION}/task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz.sha256 && \
53
- # The .sha256 does not contain the filename --> Form the correct checksum file
54
- echo "$(cat task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz.sha256) task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz" > checksum.sha256 && \
55
- sha256sum -c checksum.sha256 && \
56
- tar xvf task-runner-launcher-${LAUNCHER_VERSION}-linux-${ARCH_NAME}.tar.gz --directory=/usr/local/bin && \
57
- cd - && \
58
- rm -r /launcher-temp
59
-
60
- RUN \
61
- cd /usr/local/lib/node_modules/n8n && \
62
- npm rebuild sqlite3 && \
63
- cd - && \
64
- ln -s /usr/local/lib/node_modules/n8n/bin/n8n /usr/local/bin/n8n && \
65
- mkdir .n8n && \
66
- chown node:node .n8n
67
-
68
- # Install npm 11.4.1 to fix the vulnerable cross-spawn dependency
69
- RUN npm install -g [email protected]
70
-
71
- ENV SHELL /bin/sh
72
- USER node
73
- ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
 
1
+ FROM n8nio/n8n:latest