nbugs commited on
Commit
b781b3f
·
verified ·
1 Parent(s): 2b1ce67

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -10
Dockerfile CHANGED
@@ -1,40 +1,54 @@
1
  FROM ghcr.io/open-webui/open-webui:main
2
 
3
- # 安装Python依赖
4
  RUN apt-get update && apt-get install -y python3 python3-pip --no-install-recommends && \
5
  pip3 install --no-cache-dir huggingface_hub && \
6
  apt-get clean && \
7
  rm -rf /var/lib/apt/lists/*
8
 
9
- # 复制自定义文件
10
  COPY custom.css /app/build/assets/
11
  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
- # 创建一个简单的启动脚本
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
33
 
34
- # 设置权限
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"]
 
1
  FROM ghcr.io/open-webui/open-webui:main
2
 
3
+ # Install Python dependencies
4
  RUN apt-get update && apt-get install -y python3 python3-pip --no-install-recommends && \
5
  pip3 install --no-cache-dir huggingface_hub && \
6
  apt-get clean && \
7
  rm -rf /var/lib/apt/lists/*
8
 
9
+ # Copy custom files
10
  COPY custom.css /app/build/assets/
11
  COPY custom.js /app/build/assets/
12
  COPY editor.css /app/build/assets/
13
  COPY editor.js /app/build/assets/
14
 
15
+ # Copy backup script
16
  COPY sync_data.sh /app/sync_data.sh
17
 
18
+ # Get the ENTRYPOINT and CMD from the base image
19
  RUN echo '#!/bin/bash\n\
20
+ # Start backup process in background\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
+ # Find and execute the original entrypoint\n\
26
+ ORIGINAL_START=$(find / -name "start.sh" -type f | head -n 1)\n\
27
+ if [ -n "$ORIGINAL_START" ]; then\n\
28
+ echo "Found original start script at $ORIGINAL_START"\n\
29
+ exec $ORIGINAL_START "$@"\n\
30
+ else\n\
31
+ echo "Original start script not found, trying default locations..."\n\
32
+ if [ -f "/start.sh" ]; then\n\
33
+ exec /start.sh "$@"\n\
34
+ elif [ -f "/usr/local/bin/start.sh" ]; then\n\
35
+ exec /usr/local/bin/start.sh "$@"\n\
36
+ else\n\
37
+ echo "Cannot find start script. Container cannot start properly."\n\
38
+ exit 1\n\
39
+ fi\n\
40
+ fi\n\
41
  ' > /app/custom_start.sh && \
42
  chmod +x /app/custom_start.sh
43
 
44
+ # Modify HTML references
45
  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 && \
46
  sed -i 's|</body>|<script src="assets/editor.js"></script><script src="assets/custom.js"></script></body>|' /app/build/index.html
47
 
48
+ # Set permissions
49
  RUN chmod -R 777 ./data && \
50
  chmod -R 777 /app/backend/open_webui/static && \
51
  chmod +x /app/sync_data.sh
52
 
53
+ # Use the new start script
54
  ENTRYPOINT ["/app/custom_start.sh"]