HuggingFace0920 commited on
Commit
5488d24
·
verified ·
1 Parent(s): 2046789

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -4
Dockerfile CHANGED
@@ -6,20 +6,28 @@ ENV TZ=Asia/Shanghai
6
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
7
 
8
  # 设置工作目录
9
- WORKDIR /app
10
 
11
  # 2. 获取 OpenList 二进制文件
12
  # wget 可能未预装,所以先安装它和 ca-certificates
13
  RUN apk add --no-cache wget ca-certificates
14
 
15
  # 下载 OpenList 的最新 release 版本
16
- RUN wget -q -L https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-linux-amd64.tar.gz
17
 
18
  # 3. 解压并授予执行权限
19
  RUN tar -xzf openlist-linux-amd64.tar.gz
20
 
21
- # 授予下载的 openlist 二进制文件执行权限
22
- RUN chmod +x ./openlist
 
 
 
 
 
 
 
 
23
 
24
  # 4. 运行 OpenList 服务器
25
  # 设置容器启动时执行的命令
 
6
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
7
 
8
  # 设置工作目录
9
+ WORKDIR /
10
 
11
  # 2. 获取 OpenList 二进制文件
12
  # wget 可能未预装,所以先安装它和 ca-certificates
13
  RUN apk add --no-cache wget ca-certificates
14
 
15
  # 下载 OpenList 的最新 release 版本
16
+ RUN wget -q -O openlist-linux-amd64.tar.gz -L https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-linux-amd64.tar.gz
17
 
18
  # 3. 解压并授予执行权限
19
  RUN tar -xzf openlist-linux-amd64.tar.gz
20
 
21
+ # 检查解压后的文件,并将其移动到 /app 目录下,并确保它是可执行的
22
+ # 通常,Go 应用的二进制文件解压后可能在子目录中或名称略有不同
23
+ # 我们需要找到它并确保它在正确的路径下且具有执行权限
24
+ # 假设解压后,OpenList 的可执行文件名为 'openlist' 且可能位于一个子目录中
25
+ # 这里我们尝试查找它,如果找到就移动它
26
+ RUN sh -c "if [ -f ./openlist ]; then echo 'openlist found in root'; \
27
+ elif [ -f OpenList/openlist ]; then mv OpenList/openlist . && rm -rf OpenList; echo 'openlist found in OpenList dir'; \
28
+ elif find . -name 'openlist*' -type f -exec mv {} . \; then echo 'openlist found in subdir and moved'; \
29
+ else echo 'Error: openlist executable not found after extraction.' && exit 1; fi" \
30
+ && chmod +x ./openlist
31
 
32
  # 4. 运行 OpenList 服务器
33
  # 设置容器启动时执行的命令