# Build stage FROM node:20-alpine as builder WORKDIR /app COPY package.json ./ # 设置淘宝镜像源加速安装 RUN npm config set registry https://registry.npmmirror.com RUN npm install COPY . . RUN npm run build # Production stage FROM nginx:alpine # 复制构建产物到 Nginx 目录 COPY --from=builder /app/dist /usr/share/nginx/html # 暴露端口 EXPOSE 80 # 启动 Nginx CMD ["nginx", "-g", "daemon off;"]