Files
AIclinicalresearch/frontend-v2/Dockerfile
HaHafeng 2481b786d8 deploy: Complete 0126-27 deployment - database upgrade, services update, code recovery
Major Changes:
- Database: Install pg_bigm/pgvector plugins, create test database
- Python service: v1.0 -> v1.1, add pymupdf4llm/openpyxl/pypandoc
- Node.js backend: v1.3 -> v1.7, fix pino-pretty and ES Module imports
- Frontend: v1.2 -> v1.3, skip TypeScript check for deployment
- Code recovery: Restore empty files from local backup

Technical Fixes:
- Fix pino-pretty error in production (conditional loading)
- Fix ES Module import paths (add .js extensions)
- Fix OSSAdapter TypeScript errors
- Update Prisma Schema (63 models, 16 schemas)
- Update environment variables (DATABASE_URL, EXTRACTION_SERVICE_URL, OSS)
- Remove deprecated variables (REDIS_URL, DIFY_API_URL, DIFY_API_KEY)

Documentation:
- Create 0126 deployment folder with 8 documents
- Update database development standards v2.0
- Update SAE deployment status records

Deployment Status:
- PostgreSQL: ai_clinical_research_test with plugins
- Python: v1.1 @ 172.17.173.84:8000
- Backend: v1.7 @ 172.17.173.89:3001
- Frontend: v1.3 @ 172.17.173.90:80

Tested: All services running successfully on SAE
2026-01-27 08:13:27 +08:00

66 lines
1.7 KiB
Docker
Raw Permalink 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.
# ==================== 阶段 1: 构建阶段 ====================
# ⚠️ 使用 Node Alpine 最新版(包含 Node 22+
FROM node:alpine AS builder
# 设置工作目录
WORKDIR /app
# 1. 复制依赖文件
COPY package*.json ./
# 2. 安装依赖
# 使用国内镜像加速(可选,如果网络慢可以取消注释)
# RUN npm config set registry https://registry.npmmirror.com
RUN npm ci --only=production=false
# 3. 复制源代码
COPY . .
# 4. 构建生产版本
# ⚠️ 注意:如果需要在构建时注入环境变量,在这里设置 ARG
# ARG VITE_API_BASE_URL
# ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
# 跳过TypeScript类型检查部署优先只执行Vite构建
RUN npx vite build
# 验证构建产物
RUN ls -la /app/dist/
# ==================== 阶段 2: 运行阶段 ====================
FROM nginx:alpine
# 安装必要工具(包括时区数据)
RUN apk add --no-cache \
bash \
gettext \
curl \
tzdata
# 设置容器时区为上海(否则日志时间会比北京时间慢 8 小时)
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
# 创建 Nginx 配置目录
RUN mkdir -p /etc/nginx/templates
# 1. 复制 Nginx 配置模板(支持环境变量替换)
COPY nginx.conf /etc/nginx/templates/nginx.conf.template
# 2. 复制构建产物到 Nginx 默认目录
COPY --from=builder /app/dist /usr/share/nginx/html
# 3. 复制启动脚本
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# 健康检查
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -f http://localhost/health || exit 1
# 暴露端口
EXPOSE 80
# 启动命令
ENTRYPOINT ["/docker-entrypoint.sh"]