fix: use install.sh script to configure pnpm build dependencies
This commit is contained in:
@@ -6,12 +6,9 @@ WORKDIR /app
|
|||||||
# 允许所有包的 postinstall 脚本(Prisma/esbuild 需要)
|
# 允许所有包的 postinstall 脚本(Prisma/esbuild 需要)
|
||||||
ENV NPM_CONFIG_IGNORE_SCRIPTS=false
|
ENV NPM_CONFIG_IGNORE_SCRIPTS=false
|
||||||
|
|
||||||
# 复制依赖文件
|
# 复制依赖和安装脚本
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml install.sh ./
|
||||||
COPY .npmrc ./
|
RUN chmod +x install.sh && ./install.sh
|
||||||
|
|
||||||
# 安装依赖(pnpm 会读取 .npmrc 中的 onlyBuiltDependencies)
|
|
||||||
RUN corepack enable && pnpm install --frozen-lockfile --config.onlyBuiltDependencies="@prisma/client,@prisma/engines,esbuild,prisma"
|
|
||||||
|
|
||||||
# 复制 Prisma schema 并生成客户端
|
# 复制 Prisma schema 并生成客户端
|
||||||
COPY prisma/ ./prisma/
|
COPY prisma/ ./prisma/
|
||||||
|
|||||||
10
backend/install.sh
Normal file
10
backend/install.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
corepack enable
|
||||||
|
|
||||||
|
# 设置 pnpm 允许运行 postinstall 脚本的包
|
||||||
|
pnpm config set onlyBuiltDependencies "@prisma/client @prisma/engines esbuild prisma"
|
||||||
|
|
||||||
|
# 安装依赖
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
Reference in New Issue
Block a user