Dockerfile 400 B

12345678910111213141516171819202122232425
  1. FROM node:20 AS builder
  2. WORKDIR /app
  3. COPY package*.json ./
  4. RUN npm config set registry https://registry.npmmirror.com
  5. RUN npm install
  6. COPY . .
  7. ARG ENV=production
  8. ENV NODE_ENV=$ENV
  9. ENV VITE_APP_ENV=$ENV
  10. RUN npm run build:dev
  11. FROM nginx:alpine
  12. COPY --from=builder /app/dist /usr/share/nginx/html
  13. COPY nginx.conf /etc/nginx/conf.d/default.conf
  14. # 启动 nginx
  15. CMD ["nginx", "-g", "daemon off;"]