iouoracle commited on
Commit
d804b63
1 Parent(s): ec19e3a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -17
Dockerfile CHANGED
@@ -1,24 +1,15 @@
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
-
 
1
  # FROM lobehub/lobe-chat:v0.99.1
2
+ # 使用 multi-stage build
3
+ FROM cloudflare/cloudflared:latest as cloudflared
 
 
 
 
4
 
5
+ FROM node:20-slim as runner
6
+ WORKDIR /app
7
+ COPY --from=lobehub/lobe-chat:latest / ./
8
+ COPY --from=cloudflared /usr/local/bin/cloudflared /usr/local/bin/cloudflared
 
 
 
9
 
10
  # 设置端口
11
  EXPOSE 3210
12
  ENV PORT=3210
13
 
14
+ # 使用 node 作为基础镜像的启动命令
15
+ CMD cloudflared tunnel --no-autoupdate run --token $CF_TOKEN & node startServer.js