feat: Switch from npm to pnpm (#4429)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-11-09 17:32:05 +01:00
committed by GitHub
parent db163b71b9
commit 736777385c
33 changed files with 22666 additions and 72016 deletions

View File

@@ -3,25 +3,20 @@ ARG NODE_VERSION=16
# 1. Create an image to build n8n
FROM n8nio/base:${NODE_VERSION} as builder
RUN npm install -g run-script-os turbo@1.5.5
COPY turbo.json package.json package-lock.json tsconfig.json ./
COPY turbo.json package.json .npmrc pnpm-lock.yaml pnpm-workspace.yaml tsconfig.json ./
COPY packages ./packages
COPY patches ./patches
RUN corepack enable && corepack prepare --activate
RUN chown -R node:node .
RUN npm config set legacy-peer-deps true
USER node
RUN \
npm install && \
npm run build && \
# TODO: removing dev dependecies is deleting `bn.js`, which breaks the Snowflake node
npm prune --omit=dev && \
npm i --omit=dev bn.js && \
find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" | xargs rm &&\
rm -rf node_modules/.cache packages/*/node_modules/.cache packages/*/.turbo .config .npm /tmp/*
RUN pnpm install --frozen-lockfile
RUN pnpm build
RUN rm -rf node_modules
RUN NODE_ENV=production pnpm install --prod --no-optional
RUN find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm
RUN rm -rf patches .npmrc *.yaml node_modules/.cache packages/**/node_modules/.cache packages/**/.turbo .config .cache .local .node /tmp/*
# 2. Start with a new clean image with just the code that is needed to run n8n