live-forum/server/admin/ZrAdminNetCore/ZR.Vue/Dockerfile
zpc 8f0056c9b2
All checks were successful
continuous-integration/drone/push Build is passing
feat: admin前端改用nginx反向代理,API地址部署时可配置
2026-03-24 18:01:36 +08:00

34 lines
812 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 多阶段构建
# 第一阶段:构建阶段
FROM 192.168.195.25:19900/library/node:18-alpine AS builder
# 设置工作目录
WORKDIR /app
# 复制package.json和package-lock.json
COPY package*.json ./
# 安装依赖使用npm如果需要yarn可以修改
RUN npm install --registry=https://registry.npmmirror.com
# 复制项目文件
COPY . .
# 构建生产版本(覆盖 vite.config.js 中的 outDir
RUN npx vite build --mode production --outDir dist
# 第二阶段:运行阶段
FROM 192.168.195.25:19900/library/nginx:alpine
# 复制构建产物到nginx目录
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制nginx配置文件部署时可替换
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 暴露端口
EXPOSE 80
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]