# 管理后台 Dockerfile - 多阶段构建 # 阶段1: 构建 FROM node:18-alpine AS builder WORKDIR /app # 复制 package.json COPY package.json ./ # 安装依赖 RUN npm install --registry https://registry.npmmirror.com # 复制源代码 COPY . . # 构建 RUN npm run build # 阶段2: 运行 FROM nginx:alpine # 复制构建产物 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;"]