FROM node:18-alpine AS builder WORKDIR /app # 复制前端代码 COPY frontend/package*.json ./ RUN npm install --registry=https://registry.npmmirror.com COPY frontend/ ./ RUN npm run build # 使用 Nginx 提供静态文件 FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]