# ============ 构建阶段 ============ FROM node:18-alpine AS builder WORKDIR /app COPY package.json package-lock.json ./ RUN npm config set registry https://registry.npmmirror.com && npm install COPY . . RUN npx vite build # ============ 运行阶段 ============ FROM nginx:alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/dist /usr/share/nginx/html/ EXPOSE 9007 CMD ["nginx", "-g", "daemon off;"]