From 6b768babfd7a1e72fdd0ecedd661590fcd4261d3 Mon Sep 17 00:00:00 2001 From: lixin Date: Fri, 10 Jan 2025 15:26:02 +0800 Subject: [PATCH] =?UTF-8?q?build(Dockerfile):=20=E4=BD=BF=E7=94=A8=20pnpm?= =?UTF-8?q?=20=E6=9B=BF=E4=BB=A3=20npm=20=E8=BF=9B=E8=A1=8C=E5=8C=85?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除原有的 npm 安装命令 - 添加 pnpm 的全局安装命令 - 使用 pnpm 配置镜像源 - 替换生产环境中的 npm 安装命令为 pnpm --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c204410..5cf28bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,10 @@ COPY package.json . COPY package-lock.json* . # 设置npm镜像 -RUN npm config set registry https://registry.npmmirror.com/ && \ - npm install +RUN npm config set registry https://registry.npmmirror.com + +RUN npm install -g pnpm +RUN pnpm config set registry https://registry.npmmirror.com COPY . . @@ -24,8 +26,8 @@ COPY --from=builder /app/package.json . COPY --from=builder /app/bootstrap.js . # 设置npm镜像 -RUN npm config set registry https://registry.npmmirror.com/ && \ - npm install --production +RUN pnpm config set registry https://registry.npmmirror.com +RUN pnpm install --production ENV NODE_ENV=production ENV PORT=8001