diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c81220d1b4..7b7a1e89d2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,7 @@ "type=bind,source=${localEnv:HOME}/.n8n,target=/home/node/.n8n,consistency=cached" ], "forwardPorts": [8080, 5678], - "postCreateCommand": "corepack prepare --activate && pnpm install ", + "postCreateCommand": "corepack prepare --activate && pnpm install", "postAttachCommand": "pnpm build", "customizations": { "codespaces": { diff --git a/docker/images/n8n-custom/Dockerfile b/docker/images/n8n-custom/Dockerfile index 17f0d1c517..d0c8f0b157 100644 --- a/docker/images/n8n-custom/Dockerfile +++ b/docker/images/n8n-custom/Dockerfile @@ -6,7 +6,7 @@ FROM --platform=linux/amd64 n8nio/base:${NODE_VERSION} AS builder # Build the application from source WORKDIR /src COPY . /src -RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store --mount=type=cache,id=pnpm-metadata,target=/root/.cache/pnpm/metadata pnpm install --frozen-lockfile +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 RUN pnpm build # Delete all dev dependencies diff --git a/package.json b/package.json index 733edd2e24..98d9b2cc20 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "packageManager": "pnpm@9.6.0", "scripts": { - "prepare": "lefthook install", + "prepare": "node scripts/prepare.mjs", "preinstall": "node scripts/block-npm-install.js", "build": "turbo run build", "build:backend": "turbo run build:backend", diff --git a/packages/@n8n/benchmark/Dockerfile b/packages/@n8n/benchmark/Dockerfile index 5fa1aeae93..9525a9a4c2 100644 --- a/packages/@n8n/benchmark/Dockerfile +++ b/packages/@n8n/benchmark/Dockerfile @@ -33,6 +33,7 @@ COPY --chown=node:node ./packages/@n8n/benchmark/package.json /app/packages/@n8n COPY --chown=node:node ./patches /app/patches COPY --chown=node:node ./scripts /app/scripts +ENV DOCKER_BUILD=true RUN pnpm install --frozen-lockfile # TS config files diff --git a/scripts/prepare.mjs b/scripts/prepare.mjs new file mode 100644 index 0000000000..d729715347 --- /dev/null +++ b/scripts/prepare.mjs @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +import { execSync } from 'node:child_process'; + +// Skip lefthook install in CI or Docker build +if (process.env.CI || process.env.DOCKER_BUILD) { + process.exit(0); +} + +execSync('./node_modules/.bin/lefthook install', { stdio: 'inherit' });