forked from startrekor/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
73 lines (58 loc) · 1.74 KB
/
Dockerfile.frontend
File metadata and controls
73 lines (58 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Frontend-only Dockerfile for RAGFlow
# 专门用于构建前端镜像,可以连接到独立的后端容器
# 使用Node.js 20作为基础镜像
FROM node:20-alpine AS base
# 设置工作目录
WORKDIR /ragflow
# 安装必要的系统依赖
RUN apk add --no-cache \
git \
python3 \
make \
g++ \
&& rm -rf /var/cache/apk/*
# 复制package.json和package-lock.json
COPY web/package*.json ./web/
# 安装前端依赖
WORKDIR /ragflow/web
# 安装所有依赖(包括开发依赖),因为构建时需要
RUN npm ci
# 复制前端源代码
COPY web/src ./src
COPY web/public ./public
COPY web/config ./config
COPY web/.umirc.ts ./
COPY web/jest.config.ts ./
COPY web/jest-setup.ts ./
COPY web/tsconfig.json ./
COPY web/tailwind.config.js ./
COPY web/tailwind.css ./
COPY web/externals.d.ts ./
COPY web/typings.d.ts ./
COPY web/.eslintrc.js ./
COPY web/.prettierrc ./
COPY web/.prettierignore ./
COPY web/.npmrc ./
# 复制docs目录,因为前端代码中引用了docs文件
# 确保docs目录在正确的位置,与@parent别名对应
COPY docs ../docs
# 构建前端
RUN npm run build
# 使用nginx作为生产服务器
FROM nginx:alpine
# 安装envsubst用于环境变量替换
RUN apk add --no-cache bash
# 复制nginx配置文件
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
COPY docker/nginx/ragflow.conf.template /etc/nginx/conf.d/ragflow.conf.template
COPY docker/nginx/ragflow.conf.static /etc/nginx/conf.d/ragflow.conf.static
COPY docker/nginx/proxy.conf /etc/nginx/proxy.conf
# 复制启动脚本
COPY docker/nginx/start.sh /start.sh
RUN chmod +x /start.sh
# 复制构建好的前端文件到nginx目录
COPY --from=base /ragflow/web/dist /usr/share/nginx/html
# 暴露端口
EXPOSE 80
# 设置启动命令
CMD ["/start.sh"]