nbugs commited on
Commit
7a3d650
·
verified ·
1 Parent(s): 7d26d69

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -11
Dockerfile CHANGED
@@ -3,21 +3,35 @@ FROM ghcr.io/open-webui/open-webui:main
3
  RUN apt-get update && apt-get install -y python3 python3-pip
4
  RUN pip3 install --no-cache-dir huggingface_hub
5
 
6
- COPY sync_data.sh sync_data.sh
7
- # 复制自定义CSS和JS文件
8
  COPY custom.css /app/build/assets/
9
  COPY custom.js /app/build/assets/
10
  COPY editor.css /app/build/assets/
11
  COPY editor.js /app/build/assets/
12
 
13
- # 在</head>标签前添加custom.css引用
14
-
15
- RUN sed -i 's|</head>|<link rel="stylesheet" href="assets/editor.css"></head>|' /app/build/index.html && \
16
- sed -i 's|</body>|<script src="assets/editor.js"></script></body>|' /app/build/index.html && \
17
- sed -i 's|</head>|<link rel="stylesheet" href="assets/custom.css"></head>|' /app/build/index.html && \
18
- sed -i 's|</body>|<script src="assets/custom.js"></script></body>|' /app/build/index.html
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  RUN chmod -R 777 ./data && \
21
  chmod -R 777 /app/backend/open_webui/static && \
22
- chmod +x sync_data.sh && \
23
- sed -i "1r sync_data.sh" ./start.sh
 
 
 
3
  RUN apt-get update && apt-get install -y python3 python3-pip
4
  RUN pip3 install --no-cache-dir huggingface_hub
5
 
6
+ # 复制自定义文件
 
7
  COPY custom.css /app/build/assets/
8
  COPY custom.js /app/build/assets/
9
  COPY editor.css /app/build/assets/
10
  COPY editor.js /app/build/assets/
11
 
12
+ # 替换为优化版的备份脚本
13
+ COPY sync_data.sh /tmp/sync_data.sh
14
+
15
+ # 创建一个启动脚本
16
+ RUN echo '#!/bin/bash\n\
17
+ # 启动备份服务\n\
18
+ if [ -f "/tmp/sync_data.sh" ]; then\n\
19
+ bash /tmp/sync_data.sh &\n\
20
+ fi\n\
21
+ \n\
22
+ # 启动原始应用\n\
23
+ exec /app/start.sh "$@"\n\
24
+ ' > /app/custom_start.sh && \
25
+ chmod +x /app/custom_start.sh
26
+
27
+ # 修改HTML引用
28
+ RUN sed -i 's|</head>|<link rel="stylesheet" href="assets/editor.css"></link><link rel="stylesheet" href="assets/custom.css"></link></head>|' /app/build/index.html && \
29
+ sed -i 's|</body>|<script src="assets/editor.js"></script><script src="assets/custom.js"></script></body>|' /app/build/index.html
30
+
31
+ # 设置权限
32
  RUN chmod -R 777 ./data && \
33
  chmod -R 777 /app/backend/open_webui/static && \
34
+ chmod +x /tmp/sync_data.sh
35
+
36
+ # 使用新的启动脚本
37
+ ENTRYPOINT ["/app/custom_start.sh"]