37 lines
756 B
Docker
37 lines
756 B
Docker
# 医院绩效考核系统 - 前端 Dockerfile
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
# 复制 package 文件
|
|
COPY frontend/package*.json ./frontend/
|
|
|
|
# 安装依赖
|
|
RUN npm install
|
|
|
|
# 复制源代码
|
|
COPY frontend/ ./frontend/
|
|
|
|
# 构建前端
|
|
WORKDIR /app
|
|
RUN cd frontend && npm run build
|
|
|
|
# 生产阶段:使用 Nginx
|
|
FROM nginx:alpine
|
|
|
|
# 复制构建产物
|
|
COPY --from=builder /app/frontend/dist /usr/share/nginx/html
|
|
|
|
# 复制 Nginx 配置
|
|
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# 暴露端口
|
|
EXPOSE 80
|
|
|
|
# 健康检查
|
|
HEALTHCHECK --interval=30s --timeout=3s \
|
|
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
|
|
|
|
# 启动 Nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|