Files
yunrui_asset/frontend/Dockerfile
T
yi e9bff9beb3
Build and Push Docker Images / Build Backend Image (push) Has been cancelled
Build and Push Docker Images / Build Frontend Image (push) Has been cancelled
Build and Push Docker Images / Notify Build Complete (push) Has been cancelled
Update 2026-06-23 10:40:10
2026-06-23 10:40:10 +08:00

42 lines
948 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.
# ============================================
# 云睿资产管理系统 - 前端(NginxDockerfile
# 第一阶段:构建前端静态文件
# 第二阶段:Nginx 运行
# ============================================
# ---------- 第一阶段:构建 ----------
FROM node:20-alpine AS build
WORKDIR /app
# 复制依赖配置
COPY package.json package-lock.json* yarn.lock* ./
# 安装所有依赖(含 devDependenciesvite build 需要)
RUN npm install --ignore-scripts
# 复制前端源码
COPY . .
# 构建生产版本
RUN npm run build
# ---------- 第二阶段:Nginx 运行 ----------
FROM nginx:alpine
# 设置时区
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
# 复制 Nginx 配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 复制前端构建产物到 Nginx 静态目录
COPY --from=build /app/dist /usr/share/nginx/html
# 暴露端口
EXPOSE 80
# Nginx 前台运行
CMD ["nginx", "-g", "daemon off;"]