feat: update Dockerfile for pnpm support, enable registry switching, and remove unused packages

This commit is contained in:
wuzhiqing 2024-09-19 09:13:07 +00:00 committed by DDDDD12138
parent 74add79c8f
commit 3069b5cfc3
2 changed files with 13 additions and 9 deletions

4
.npmrc Normal file
View File

@ -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/

View File

@ -1,20 +1,20 @@
FROM node:18-alpine AS base FROM node:20-alpine AS base
# 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
FROM base AS deps FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json yarn.lock ./ COPY .npmrc package.json pnpm-lock.yaml ./
RUN yarn config set registry 'https://registry.npmmirror.com/' RUN pnpm install
RUN yarn install
FROM base AS builder FROM base AS builder
RUN apk update && apk add --no-cache git
ENV OPENAI_API_KEY="" ENV OPENAI_API_KEY=""
ENV GOOGLE_API_KEY="" ENV GOOGLE_API_KEY=""
ENV CODE="" ENV CODE=""
@ -23,7 +23,7 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
RUN yarn build RUN pnpm build
FROM base AS runner FROM base AS runner
WORKDIR /app WORKDIR /app