Dockerfile 439 B

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