File size: 767 Bytes
793e953 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # ================================================================
# VetCopilot 前端 Dockerfile(多阶段构建)
#
# 构建: docker build -f deploy/Dockerfile.frontend -t vetcopilot-frontend .
# ================================================================
# ---- Stage 1: 构建 ----
FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
# 构建参数:API 地址(Nginx 反向代理,同域 /api)
ENV VITE_API_BASE=/api
RUN npm run build
# ---- Stage 2: 运行时(Nginx) ----
FROM nginx:alpine
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制 Nginx 配置
COPY nginx-site.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
|