# 1. 使用 anthingllm:latest 官方镜像作为基础 FROM mintplexlabs/anythingllm:latest # 2. 切换到 root 用户以安装软件包 USER root # 3. 安装持久化方案所需的全部工具 # git: 用于 GitHub 备份 # rclone: 用于 WebDAV 高效同步 # util-linux: 提供 flock 文件锁工具 # sqlite3: 用于安全的数据库在线备份 # rsync: 用于高效、安全地在目录间同步文件 # curl: 用于健康检查 RUN apt-get update && apt-get install -y --no-install-recommends \ git \ rclone \ util-linux \ sqlite3 \ rsync \ curl \ && rm -rf /var/lib/apt/lists/* # 4. 创建脚本目录 RUN mkdir -p /app/scripts # 5. 复制所有脚本和配置文件到容器内 COPY scripts/ /app/scripts/ COPY entrypoint.sh /app/entrypoint.sh # 6. 赋予所有脚本执行权限 RUN chmod +x /app/entrypoint.sh /app/scripts/*.sh # 7. 切换回官方镜像指定的非 root 用户 USER anythingllm # 8. 设置工作目录 WORKDIR /app/server # 9. 定义容器的入口点 ENTRYPOINT ["/app/entrypoint.sh"]