iouoracle commited on
Commit
ec19e3a
1 Parent(s): 1858ed8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -4
Dockerfile CHANGED
@@ -1,12 +1,24 @@
1
  # FROM lobehub/lobe-chat:v0.99.1
 
 
 
 
 
 
 
 
2
  FROM lobehub/lobe-chat:latest
3
 
4
- # 从 cloudflare 镜像复制 cloudflared
5
- COPY --from=cloudflare/cloudflared:latest /usr/local/bin/cloudflared /usr/local/bin/cloudflared
 
 
6
 
7
  # 设置端口
8
  EXPOSE 3210
9
  ENV PORT=3210
10
 
11
- # 使用 CMD 而不是创建脚本
12
- CMD cloudflared tunnel --no-autoupdate run --token $CF_TOKEN & /docker-entrypoint.sh
 
 
 
1
  # FROM lobehub/lobe-chat:v0.99.1
2
+ # 使用 busybox 作为中间镜像来准备文件
3
+ FROM busybox:latest AS prepare
4
+ COPY --from=cloudflare/cloudflared:latest /usr/local/bin/cloudflared /bin/cloudflared
5
+ RUN mkdir -p /app && \
6
+ echo '#!/bin/sh\ncloudflared tunnel --no-autoupdate run --token $CF_TOKEN & \nexec /bin/node /app/startServer.js' > /app/start.sh && \
7
+ chmod +x /app/start.sh
8
+
9
+ # 最终镜像
10
  FROM lobehub/lobe-chat:latest
11
 
12
+ # 复制需要的文件
13
+ COPY --from=prepare /bin/cloudflared /bin/cloudflared
14
+ COPY --from=prepare /app/start.sh /app/start.sh
15
+ COPY --from=busybox:latest /bin/sh /bin/sh
16
 
17
  # 设置端口
18
  EXPOSE 3210
19
  ENV PORT=3210
20
 
21
+ # 使用新的启动脚本
22
+ ENTRYPOINT ["/bin/sh"]
23
+ CMD ["/app/start.sh"]
24
+