# ===== 构建阶段 ===== FROM node:22-alpine AS builder WORKDIR /app # 复制依赖文件并安装 COPY package*.json ./ RUN npm install # 复制源码并构建 COPY . . RUN npm run build-only -- --mode production # ===== 运行阶段 ===== FROM nginx:stable-alpine # 复制构建产物到 nginx 目录 COPY --from=builder /app/dist /usr/share/nginx/html # 复制 nginx 配置 COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]