FROM alpine:latest WORKDIR /opt/cloudreve ENV TZ=Asia/Shanghai # 下载 Cloudreve 3.8.3 RUN apk update && \ apk add --no-cache wget unzip python3 py3-pip bash tar gzip jq curl aria2 && \ rm -rf /var/cache/apk/* # 创建 Cloudreve 数据目录 RUN mkdir -p /opt/cloudreve/data RUN wget -O cloudreve.tar.gz "https://github.com/cloudreve/Cloudreve/releases/download/3.8.3/cloudreve_3.8.3_linux_amd64.tar.gz" && \ tar -zxvf cloudreve.tar.gz && \ rm cloudreve.tar.gz # 创建虚拟环境并安装依赖 ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN pip install --no-cache-dir huggingface_hub cryptography # 复制同步脚本 COPY sync_data.sh /opt/cloudreve/ # 设置同步脚本执行权限 RUN chmod +x /opt/cloudreve/sync_data.sh # **确保 /opt/cloudreve 目录及其内容有读写执行权限** RUN chmod -R 777 /opt/cloudreve/ # **新增:在啟動 Cloudreve 之前刪除 config.ini** RUN rm -f /opt/cloudreve/config.ini # **新增:创建 Aria2 下载目录并设置权限** RUN mkdir -p /opt/cloudreve/aria2_downloads && chmod -R 777 /opt/cloudreve/aria2_downloads # **新增:复制 Aria2 配置文件 (如果需要)** COPY aria2.conf /etc/aria2/aria2.conf # 暴露 Cloudreve 端口 EXPOSE 5212 # 设置启动命令 to run Cloudreve in foreground and sync script in background CMD aria2c --conf-path=/etc/aria2/aria2.conf --daemon & sleep 5 && /opt/cloudreve/cloudreve -c /opt/cloudreve/config.ini & /opt/cloudreve/sync_data.sh