From c480d3cc6a9f015a1262ea52988b32825f05a183 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Wed, 18 Jun 2025 16:38:14 +0300 Subject: [PATCH] fix(core): Fix pdf extract not working (#16463) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ --- docker/images/n8n/Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker/images/n8n/Dockerfile b/docker/images/n8n/Dockerfile index ea32bd88db..77092653a6 100644 --- a/docker/images/n8n/Dockerfile +++ b/docker/images/n8n/Dockerfile @@ -10,15 +10,21 @@ RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store --moun RUN pnpm build # Delete all dev dependencies -RUN jq 'del(.pnpm.patchedDependencies)' package.json > package.json.tmp; mv package.json.tmp package.json RUN node .github/scripts/trim-fe-packageJson.js +# We don't want to remove all patches because we want them still to be applied +# in `pnpm deploy`. However, we need to remove FE patches because we trim the FE +# package.json files and `pnpm deploy` will fail otherwise. element-plus is the +# only FE patch that we need to remove. +RUN jq '.pnpm.patchedDependencies |= with_entries(select(.key | startswith("pdfjs-dist") or startswith("pkce-challenge")))' package.json > package.json.tmp; mv package.json.tmp package.json # Delete any source code or typings RUN find . -type f -name "*.ts" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf # Deploy the `n8n` package into /compiled RUN mkdir /compiled -RUN NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --no-optional --legacy deploy /compiled +# We don't want to use --no-optional because pdfjs-dist has an optional dependency on +# @napi-rs/canvas, which is required for the pdfjs-dist package to work. +RUN NODE_ENV=production DOCKER_BUILD=true pnpm --filter=n8n --prod --legacy deploy /compiled # 2. Start with a new clean image with just the code that is needed to run n8n FROM n8nio/base:${NODE_VERSION}