flzta commited on
Commit
36cbaff
·
verified ·
1 Parent(s): 894e3c9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -18
Dockerfile CHANGED
@@ -21,19 +21,17 @@ RUN wget -O cloudreve.tar.gz "https://github.com/cloudreve/Cloudreve/releases/do
21
  chmod +x /opt/cloudreve/cloudreve
22
 
23
  # 创建虚拟环境 (推荐)
 
24
  RUN python3 -m venv /opt/venv
25
  ENV VIRTUAL_ENV=/opt/venv
26
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
27
 
28
- # 安装 huggingface_hub Python 库
29
- # 注意:如果你的 sync_data.sh Cloudreve 需要这些库,请保留
30
- RUN pip install --no-cache-dir huggingface_hub cryptography
31
 
32
- # 复制同步脚本到容器中
33
- COPY sync_data.sh /opt/cloudreve/
34
-
35
- # 给予同步脚本执行权限
36
- RUN chmod +x /opt/cloudreve/sync_data.sh
37
 
38
  # **创建 Aria2 下载目录并设置权限**
39
  # 注意:777 权限过于宽松,生产环境建议使用更严格的权限管理
@@ -47,31 +45,40 @@ RUN chmod -R 777 /opt/cloudreve/
47
  EXPOSE 5212
48
 
49
  # 设置启动命令
50
- # 1. 后台启动 Aria2
51
- # 2. (可选) 运行 sync_data.sh 脚本一次
52
- # 3. 前台启动 Cloudreve 主程序 (它会在 /opt/cloudreve 目录下查找或创建 conf.ini)
53
  CMD aria2c --enable-rpc --rpc-listen-port=6800 --rpc-listen-all=true --rpc-allow-origin-all \
54
  --enable-dht=true \
55
  # --- 使用精简后的 Tracker 列表 ---
56
  --bt-tracker="udp://tracker.opentrackr.org:1337/announce,udp://open.tracker.cl:1337/announce,udp://tracker.openbittorrent.com:6969/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.dler.org:6969/announce,http://tracker.openbittorrent.com:80/announce,https://opentracker.i2p.rocks:443/announce,wss://tracker.openwebtorrent.com,wss://tracker.btorrent.xyz" \
57
  # -----------------------------
58
- # --- 调整后的参数 (可根据实际情况微调) ---
59
  -s 50 \
60
- -x 20 \
 
 
61
  --max-overall-upload-limit=1M \
 
62
  --max-upload-limit=512K \
 
63
  --max-overall-download-limit=0 \
 
64
  --max-download-limit=0 \
 
65
  --max-concurrent-downloads=5 \
66
- # --bt-require-crypto=true \ # 暂时注释掉强制加密
 
67
  # -----------------------------
68
  -d /opt/cloudreve/aria2_downloads \
 
69
  --rpc-secret=1234 \
 
70
  --console-log-level=info \
 
71
  --daemon=true & \
72
- # 等待 Aria2 RPC 服务启动
 
73
  sleep 5 && \
74
- # 运行一次同步脚本
75
- /opt/cloudreve/sync_data.sh && \
76
- # 在前台启动 Cloudreve (不带 -c 参数,它会在 WORKDIR /opt/cloudreve 中自动处理 conf.ini)
77
  /opt/cloudreve/cloudreve
 
21
  chmod +x /opt/cloudreve/cloudreve
22
 
23
  # 创建虚拟环境 (推荐)
24
+ # 如果 Cloudreve 本身不需要 Python,且我们移除了 sync_data.sh,这部分可能也可以移除,但暂时保留
25
  RUN python3 -m venv /opt/venv
26
  ENV VIRTUAL_ENV=/opt/venv
27
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
28
 
29
+ # 安装 huggingface_hub Python 库 (仅当 Cloudreve 本身需要时保留)
30
+ # RUN pip install --no-cache-dir huggingface_hub cryptography
 
31
 
32
+ # --- 移除了 sync_data.sh 相关的复制和权限设置 ---
33
+ # COPY sync_data.sh /opt/cloudreve/
34
+ # RUN chmod +x /opt/cloudreve/sync_data.sh
 
 
35
 
36
  # **创建 Aria2 下载目录并设置权限**
37
  # 注意:777 权限过于宽松,生产环境建议使用更严格的权限管理
 
45
  EXPOSE 5212
46
 
47
  # 设置启动命令
48
+ # 1. 后台启动 Aria2 (使用修正后的参数)
49
+ # 2. 前台启动 Cloudreve (它将成为容器的主进程)
 
50
  CMD aria2c --enable-rpc --rpc-listen-port=6800 --rpc-listen-all=true --rpc-allow-origin-all \
51
  --enable-dht=true \
52
  # --- 使用精简后的 Tracker 列表 ---
53
  --bt-tracker="udp://tracker.opentrackr.org:1337/announce,udp://open.tracker.cl:1337/announce,udp://tracker.openbittorrent.com:6969/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.dler.org:6969/announce,http://tracker.openbittorrent.com:80/announce,https://opentracker.i2p.rocks:443/announce,wss://tracker.openwebtorrent.com,wss://tracker.btorrent.xyz" \
54
  # -----------------------------
55
+ # --- 调整后的参数 ---
56
  -s 50 \
57
+ # 每个种子的最大连接数
58
+ -x 16 \
59
+ # !!! 修正:单服务器最大连接数 (必须在 1-16 之间) !!!
60
  --max-overall-upload-limit=1M \
61
+ # 总上传速度限制 (示例 1MB/s)
62
  --max-upload-limit=512K \
63
+ # 单任务上传速度限制 (示例 512KB/s)
64
  --max-overall-download-limit=0 \
65
+ # 不限制总下载速度
66
  --max-download-limit=0 \
67
+ # 不限制单任务下载速度
68
  --max-concurrent-downloads=5 \
69
+ # 最大同时下载任务数
70
+ # --bt-require-crypto=true \ # 暂时注释掉强制加密,方便测试
71
  # -----------------------------
72
  -d /opt/cloudreve/aria2_downloads \
73
+ # 下载文件保存目录
74
  --rpc-secret=1234 \
75
+ # RPC 访问密钥,必须与 Cloudreve 后台设置一致
76
  --console-log-level=info \
77
+ # Aria2 日志级别,方便排查问题
78
  --daemon=true & \
79
+ # 后台运行 Aria2
80
+ # 等待 Aria2 RPC 服务启动 (给点时间)
81
  sleep 5 && \
82
+ # --- 移除了执行 sync_data.sh 的步骤 ---
83
+ # 在前台启动 Cloudreve (它会在 /opt/cloudreve 目录下查找或创建 conf.ini)
 
84
  /opt/cloudreve/cloudreve