From e437ed704aec117c3c6bd5c0b1f98138df0bada7 Mon Sep 17 00:00:00 2001 From: wuzhiqing Date: Thu, 19 Sep 2024 09:13:07 +0000 Subject: [PATCH] feat: update Dockerfile for pnpm support, enable registry switching, and remove unused packages --- .npmrc | 4 ++++ Dockerfile | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000000..7386180be4f9 --- /dev/null +++ b/.npmrc @@ -0,0 +1,4 @@ +# if you located in China, you can use taobao registry to speed up. +# You can also specify your own private npm registry, which will be effective in local development, deployment, and Docker environments. + +# registry=https://registry.npmmirror.com/ diff --git a/Dockerfile b/Dockerfile index ae9a17cddbda..78d4d5798e09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ -FROM node:18-alpine AS base +FROM node:20-alpine AS base -FROM base AS deps +# if you located in China, you can use taobao registry to speed up +# RUN npm config set registry 'https://registry.npmmirror.com/' + +RUN npm install -g pnpm@latest-9 -RUN apk add --no-cache libc6-compat +FROM base AS deps WORKDIR /app -COPY package.json yarn.lock ./ +COPY .npmrc package.json pnpm-lock.yaml ./ -RUN yarn config set registry 'https://registry.npmmirror.com/' -RUN yarn install +RUN pnpm install FROM base AS builder -RUN apk update && apk add --no-cache git - ENV OPENAI_API_KEY="" ENV GOOGLE_API_KEY="" ENV CODE="" @@ -23,7 +23,7 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . -RUN yarn build +RUN pnpm build FROM base AS runner WORKDIR /app