# MiroFish Frontend Dockerfile # Multi-stage build: Node.js build + Nginx serve # ============= Build Stage ============= FROM node:20-alpine as builder WORKDIR /app # 复制 package 文件 COPY package*.json ./ # 安装依赖 RUN npm ci # 复制源代码 COPY . . # 构建生产版本 RUN npm run build # ============= Production Stage ============= FROM nginx:alpine # 复制 Nginx 配置 COPY nginx.conf /etc/nginx/conf.d/default.conf # 复制构建产物 COPY --from=builder /app/dist /usr/share/nginx/html # 暴露端口 EXPOSE 80 # 启动 Nginx CMD ["nginx", "-g", "daemon off;"]