feat: add Docker support for automated deployment

This commit is contained in:
2026-02-28 16:07:38 +08:00
parent aed0e589f7
commit 2e6d8c28c4
7 changed files with 688 additions and 0 deletions

35
Dockerfile.frontend Normal file
View File

@@ -0,0 +1,35 @@
# 医院绩效考核系统 - 前端 Dockerfile
FROM node:18-alpine AS builder
WORKDIR /app
# 复制 package 文件
COPY frontend/package*.json ./
# 安装依赖
RUN npm install --production
# 复制源代码
COPY frontend/ ./
# 构建前端
RUN npm run build
# 生产阶段:使用 Nginx
FROM nginx:alpine
# 复制构建产物
COPY --from=builder /app/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;"]