nbugs commited on
Commit
8b18ded
·
verified ·
1 Parent(s): 9f26420

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -1
Dockerfile CHANGED
@@ -12,9 +12,21 @@ COPY custom.js /app/build/assets/
12
  COPY editor.css /app/build/assets/
13
  COPY editor.js /app/build/assets/
14
 
15
- # 复制备份脚本但不执行
16
  COPY sync_data.sh /app/sync_data.sh
17
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  # 修改HTML引用
19
  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 && \
20
  sed -i 's|</body>|<script src="assets/editor.js"></script><script src="assets/custom.js"></script></body>|' /app/build/index.html
@@ -23,3 +35,6 @@ RUN sed -i 's|</head>|<link rel="stylesheet" href="assets/editor.css"></link><li
23
  RUN chmod -R 777 ./data && \
24
  chmod -R 777 /app/backend/open_webui/static && \
25
  chmod +x /app/sync_data.sh
 
 
 
 
12
  COPY editor.css /app/build/assets/
13
  COPY editor.js /app/build/assets/
14
 
15
+ # 复制备份脚本
16
  COPY sync_data.sh /app/sync_data.sh
17
 
18
+ # 创建一个简单的启动脚本
19
+ RUN echo '#!/bin/bash\n\
20
+ # 在后台启动备份进程\n\
21
+ if [ -f "/app/sync_data.sh" ]; then\n\
22
+ (nohup bash /app/sync_data.sh > /tmp/sync.log 2>&1 &)\n\
23
+ fi\n\
24
+ \n\
25
+ # 启动原始应用\n\
26
+ exec /app/start.sh "$@"\n\
27
+ ' > /app/custom_start.sh && \
28
+ chmod +x /app/custom_start.sh
29
+
30
  # 修改HTML引用
31
  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 && \
32
  sed -i 's|</body>|<script src="assets/editor.js"></script><script src="assets/custom.js"></script></body>|' /app/build/index.html
 
35
  RUN chmod -R 777 ./data && \
36
  chmod -R 777 /app/backend/open_webui/static && \
37
  chmod +x /app/sync_data.sh
38
+
39
+ # 使用新的启动脚本
40
+ ENTRYPOINT ["/app/custom_start.sh"]