|  | @@ -64,22 +64,30 @@
 | 
	
		
			
				|  |  |  # # 使用 bash 启动应用
 | 
	
		
			
				|  |  |  # CMD ["/bin/bash", "-c", "node_modules/.bin/next start"]
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -# Install dependencies only when needed
 | 
	
		
			
				|  |  | +# Stage 1: Dependencies
 | 
	
		
			
				|  |  |  FROM node:alpine AS deps
 | 
	
		
			
				|  |  |  # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
 | 
	
		
			
				|  |  |  RUN apk add --no-cache libc6-compat
 | 
	
		
			
				|  |  |  WORKDIR /app
 | 
	
		
			
				|  |  | -COPY package.json yarn.lock ./
 | 
	
		
			
				|  |  | -RUN yarn install --frozen-lockfile
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -# Rebuild the source code only when needed
 | 
	
		
			
				|  |  | +# 安装 pnpm
 | 
	
		
			
				|  |  | +RUN npm install -g pnpm
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +COPY package.json pnpm-lock.yaml* ./
 | 
	
		
			
				|  |  | +RUN pnpm install --frozen-lockfile
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +# Stage 2: Builder
 | 
	
		
			
				|  |  |  FROM node:alpine AS builder
 | 
	
		
			
				|  |  |  WORKDIR /app
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +# 安装 pnpm
 | 
	
		
			
				|  |  | +RUN npm install -g pnpm
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  COPY . .
 | 
	
		
			
				|  |  |  COPY --from=deps /app/node_modules ./node_modules
 | 
	
		
			
				|  |  | -RUN yarn build && yarn install --production --ignore-scripts --prefer-offline
 | 
	
		
			
				|  |  | +RUN pnpm build && pnpm install --prod --ignore-scripts --prefer-offline
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -# Production image, copy all the files and run next
 | 
	
		
			
				|  |  | +# Stage 3: Runner
 | 
	
		
			
				|  |  |  FROM node:alpine AS runner
 | 
	
		
			
				|  |  |  WORKDIR /app
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -106,5 +114,4 @@ ENV PORT 3000
 | 
	
		
			
				|  |  |  # Uncomment the following line in case you want to disable telemetry.
 | 
	
		
			
				|  |  |  # ENV NEXT_TELEMETRY_DISABLED 1
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -# CMD ["node_modules/.bin/next", "start"]
 | 
	
		
			
				|  |  | -CMD ["/bin/bash", "-c", "node_modules/.bin/next start"]
 | 
	
		
			
				|  |  | +CMD ["node", "node_modules/.bin/next", "start"]
 |