Update Dockerfile
Browse files- Dockerfile +8 -79
Dockerfile
CHANGED
|
@@ -1,79 +1,8 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# 更新包列表并安装必要的软件包:wget, unzip, python3, pip, bash, tar, gzip, jq, curl, aria2, netcat-openbsd
|
| 11 |
-
# 清理 apk 缓存以减小镜像体积
|
| 12 |
-
RUN apk update && \
|
| 13 |
-
apk add --no-cache wget unzip python3 py3-pip bash tar gzip jq curl aria2 netcat-openbsd && \
|
| 14 |
-
rm -rf /var/cache/apk/*
|
| 15 |
-
|
| 16 |
-
# 下载并解压 Cloudreve 3.8.3
|
| 17 |
-
RUN wget -O cloudreve.tar.gz "https://github.com/cloudreve/Cloudreve/releases/download/3.8.3/cloudreve_3.8.3_linux_amd64.tar.gz" && \
|
| 18 |
-
tar -zxvf cloudreve.tar.gz -C /opt/cloudreve/ && \
|
| 19 |
-
rm cloudreve.tar.gz && \
|
| 20 |
-
# 确保 Cloudreve 可执行文件有执行权限
|
| 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 |
-
RUN pip install --no-cache-dir huggingface_hub cryptography
|
| 30 |
-
|
| 31 |
-
# 复制同步脚本到容器中
|
| 32 |
-
COPY sync_data.sh /opt/cloudreve/
|
| 33 |
-
|
| 34 |
-
# 给予同步脚本执行权限
|
| 35 |
-
RUN chmod +x /opt/cloudreve/sync_data.sh
|
| 36 |
-
|
| 37 |
-
# **创建 Aria2 下载目录并设置权限**
|
| 38 |
-
RUN mkdir -p /opt/cloudreve/aria2_downloads && chmod -R 777 /opt/cloudreve/aria2_downloads
|
| 39 |
-
|
| 40 |
-
# **确保 /opt/cloudreve 目录及其内容具有必要的权限**
|
| 41 |
-
RUN chmod -R 777 /opt/cloudreve/
|
| 42 |
-
|
| 43 |
-
# 暴露 Cloudreve 使用的端口
|
| 44 |
-
EXPOSE 5212
|
| 45 |
-
|
| 46 |
-
# 设置启动命令
|
| 47 |
-
# 1. 后台启动 Aria2,尝试平衡配置以获得更好速度且避免快速终止
|
| 48 |
-
# 2. 前台运行 sync_data.sh 脚本
|
| 49 |
-
CMD aria2c --enable-rpc --rpc-listen-port=6800 --rpc-listen-all=true --rpc-allow-origin-all \
|
| 50 |
-
--enable-dht=true \
|
| 51 |
-
# --- 使用更新的 Tracker 列表 ---
|
| 52 |
-
--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://exodus.desync.com:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.moeking.me:6969/announce,udp://tracker.dler.org:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.theoks.net:6969/announce,udp://tracker-udp.gbitt.info:80/announce,udp://ln.mt.unej.cz:6969/announce,udp://ipv4.tracker.harry.lu:80/announce,udp://explodie.org:6969/announce,udp://bt2.archive.org:6969/announce,udp://bt1.archive.org:6969/announce,http://tracker.openbittorrent.com:80/announce,http://tracker.dler.org:6969/announce,http://tracker.opentrackr.org:1337/announce,http://open.tracker.cl:1337/announce,http://ln.mt.unej.cz:6969/announce,https://tracker.tamersunion.org:443/announce,https://tracker.loligirl.cn:443/announce,https://tracker.gbitt.info:443/announce,https://tracker.bz:443/announce,https://opentracker.i2p.rocks:443/announce,https://open.acgnxtracker.com:443/announce,ws://tracker.openwebtorrent.com:80/announce,ws://tracker.btorrent.xyz:80/announce" \
|
| 53 |
-
# -----------------------------
|
| 54 |
-
# --- 尝试恢复到之前的 "平衡点" 配置 ---
|
| 55 |
-
-s 20 \
|
| 56 |
-
# 恢复到稍高连接数 (尝试 20)
|
| 57 |
-
-x 16 \
|
| 58 |
-
# 单服务器连接数
|
| 59 |
-
--max-overall-upload-limit=512K \
|
| 60 |
-
# 恢复到稍高的上传限制 (尝试 64 KB/s)
|
| 61 |
-
--max-upload-limit=256K \
|
| 62 |
-
# 单任务上传
|
| 63 |
-
--max-overall-download-limit=0 \
|
| 64 |
-
# 仍然不限制下载,看它能跑多少
|
| 65 |
-
--max-download-limit=0 \
|
| 66 |
-
--max-concurrent-downloads=2 \
|
| 67 |
-
# 并发任务数保持较低 (尝试 2)
|
| 68 |
-
--bt-require-crypto=true \
|
| 69 |
-
# 保持强制加密
|
| 70 |
-
# -----------------------------
|
| 71 |
-
-d /opt/cloudreve/aria2_downloads \
|
| 72 |
-
--rpc-secret=1234 \
|
| 73 |
-
# --- 日志级别使用 info ---
|
| 74 |
-
--console-log-level=info \
|
| 75 |
-
# ---------------------
|
| 76 |
-
--daemon=true & \
|
| 77 |
-
/opt/cloudreve/sync_data.sh
|
| 78 |
-
|
| 79 |
-
# 注意 RPC Secret 和备份间隔 (SYNC_INTERVAL 环境变量)
|
|
|
|
| 1 |
+
docker run -d -p 5212:5212 \
|
| 2 |
+
# !!! 关键:挂载卷以持久化数据和配置 !!!
|
| 3 |
+
-v /path/on/host/cloudreve/config:/opt/cloudreve \ # 挂载包含 conf.ini 的目录
|
| 4 |
+
-v /path/on/host/cloudreve/data:/opt/cloudreve/data \ # 挂载数据目录 (如果使用 SQLite)
|
| 5 |
+
-v /path/on/host/cloudreve/uploads:/opt/cloudreve/uploads \ # 挂载上传目录
|
| 6 |
+
-v /path/on/host/cloudreve/aria2_downloads:/opt/cloudreve/aria2_downloads \ # 挂载 Aria2 下载目录
|
| 7 |
+
--name cloudreve-container \
|
| 8 |
+
my-cloudreve-app # 使用你构建的镜像名
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|