keepmove commited on
Commit
36bc2de
·
verified ·
1 Parent(s): 3828b6b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -13
Dockerfile CHANGED
@@ -1,26 +1,27 @@
1
- # 使用指定的基础镜像
2
- FROM jonssonyan/h-ui
3
-
4
- # 设置工作目录
5
- WORKDIR /h-ui
6
 
7
  # 安装 curl
8
  RUN apk add --no-cache curl
9
 
10
- # 测试网络连接
11
- RUN curl -I https://github.com
12
-
13
- # 创建 bin 目录
14
- RUN mkdir -p /h-ui/bin
15
-
16
  # 下载 hysteria2 二进制文件
17
- RUN curl -L -o /h-ui/bin/hysteria2 https://github.com/apernet/hysteria/releases/latest/download/hysteria-linux-amd64 && \
 
18
  chmod +x /h-ui/bin/hysteria2
19
 
 
 
 
 
 
 
 
 
 
20
  # 创建 logs、data 和 export 目录并授予写权限
21
  RUN mkdir -p /h-ui/logs /h-ui/data /h-ui/export && chmod -R 777 /h-ui/logs /h-ui/data /h-ui/export
22
 
23
- # 暴露8081端口
24
  EXPOSE 8081
25
 
26
  # 启动命令
 
1
+ # 第一阶段:用于下载 hysteria2
2
+ FROM alpine:latest AS downloader
 
 
 
3
 
4
  # 安装 curl
5
  RUN apk add --no-cache curl
6
 
 
 
 
 
 
 
7
  # 下载 hysteria2 二进制文件
8
+ RUN mkdir -p /h-ui/bin && \
9
+ curl -L -o /h-ui/bin/hysteria2 https://github.com/apernet/hysteria/releases/latest/download/hysteria-linux-amd64 && \
10
  chmod +x /h-ui/bin/hysteria2
11
 
12
+ # 第二阶段:使用 jonssonyan/h-ui 镜像
13
+ FROM jonssonyan/h-ui
14
+
15
+ # 设置工作目录
16
+ WORKDIR /h-ui
17
+
18
+ # 从 downloader 阶段复制 hysteria2
19
+ COPY --from=downloader /h-ui/bin/hysteria2 /h-ui/bin/hysteria2
20
+
21
  # 创建 logs、data 和 export 目录并授予写权限
22
  RUN mkdir -p /h-ui/logs /h-ui/data /h-ui/export && chmod -R 777 /h-ui/logs /h-ui/data /h-ui/export
23
 
24
+ # 暴露 8081 端口
25
  EXPOSE 8081
26
 
27
  # 启动命令