astrbot

mioyisama/astrbot Docker 镜像

基于官方AstrBot优化的Docker镜像,遵循不可变基础设施标准,分离环境依赖与业务数据,固化Dashboard版本,内置记忆、表情包管理、网络搜索及主动消息四大插件,提供开箱即用的长期稳定服务。

下载次数: 0状态:社区镜像维护者:mioyisama仓库类型:镜像最近更新:
下载命令
点击查看

🚀 AstrBot - 优化版 Docker 镜像

基于官方 AstrBot 重新打包的优化版 Docker 镜像。

官方原版镜像在数据挂载层面将过多内容交给了外部 Volume,容易导致插件依赖损坏和环境变得不易维护。本镜像遵循 Docker 容器化“不可变基础设施”的最高实践标准,将环境依赖与业务数据严格分离,为您提供一个真正的开箱即用、长期且稳定的 AstrBot 服务。

✨ 核心优化与特性

  • Dashboard 固化集成:固定 Dashboard 版本并直接打包进入镜像本体,消除容器内外版本不一致带来的异常问题。
  • 严谨的持久化方案:利用软链接重新规划了 plugins 的路径(将它移出数据挂载卷 volume 而打包进镜像本体内)。确保应用代码与用户数据(/app/data)分离。
  • 内置四大优质插件:镜像开箱即自带并调优完成以下依赖环境,无需额外手动配置:
    • https://github.com/lxfight/astrbot_plugin_mnemosyne - 记忆功能
    • https://github.com/anka-afk/astrbot_plugin_meme_manager - 表情包管理
    • https://github.com/zouyonghe/astrbot_plugin_web_searcher_pro - SearXNG 网络搜索
    • https://github.com/DBJD-CR/astrbot_plugin_proactive_chat - 主动消息机制
  • 依赖版本锁定:自动将 setuptools 版本固定在 <82,规避由于依赖漂移导致的构建与运行错误。

⚠️ 重要警告 (Best Practices)

【极度不建议】在容器启动后,通过 WebUI 或进入容器拉取更新 Dashboard,或者手动安装其他新插件!

手动安装插件或修改程序本体会 严重破坏 镜像内置的全局依赖树,使应用失去 Docker 环境提供的「隔离性」和「可复现性」。 如果您确实需要添加新插件或更新版本,请 自定义修改 Dockerfile 然后重新构建镜像,而不是在运行时的容器内进行热修改。


🚀 快速开始 (Quick Start)

1. 启动容器 (Docker Compose)

创建 docker-compose.yml 文件:

yaml
services:
  astrbot:
    image: docker.xuanyuan.run/mioyisama/astrbot:v4.25.0 # 替换为您实际推送到 Hub 的镜像名称

    container_name: astrbot
    restart: unless-stopped
    networks:
      - astrbot
    volumes:
      - ./data:/app/data
      - /etc/localtime:/etc/localtime:ro

networks:
  astrbot:
    name: astrbot

随后执行启动命令即可享用:

bash
docker compose up -d

2. 构建您的自定义版本 (Build from source)

如果您希望更换绑定的 AstrBot 版本,或是想要在镜像中固化更多您喜欢的插件,可以克隆本仓库的 Dockerfile 并按需调整参数重新打包。

构建命令示例:

bash
# 默认构建
docker build -t astrbot:v4.24.5 -t astrbot:latest .

# 指定构建版本
docker build -t astrbot:v4.24.5 -t astrbot:latest --build-arg VERSION=v4.24.5 .

附录:如何添加自己的固化插件? 在 Dockerfile 末尾,参考已有插件的安装格式添加对应的语句:

dockerfile
RUN --mount=type=cache,target=/root/.cache/uv \
    git clone --depth 1 https://github.com/作者/您的目标插件.git plugins/目标插件 \
    && rm -rf plugins/目标插件/.git \
    && uv pip install -r plugins/目标插件/requirements.txt

附:Dockerfile

dockerfile
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim

# docker build -t astrbot:v4.24.5 -t astrbot:latest --build-arg VERSION=v4.24.5 .
ARG VERSION=v4.24.5

ENV UV_SYSTEM_PYTHON=1 \
    UV_LINK_MODE=copy

# 安装系统依赖
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
    && apt-get install -y --no-install-recommends git curl unzip \
    && rm -rf /var/lib/apt/lists/*

# 克隆AstrBot代码库
RUN git clone --depth 1 --branch ${VERSION} --single-branch \
    https://github.com/AstrBotDevs/AstrBot.git /app \
    && rm -rf /app/.git

WORKDIR /app

# 下载并解压WebUI
RUN curl -L https://github.com/AstrBotDevs/AstrBot/releases/download/${VERSION}/AstrBot-${VERSION}-dashboard.zip -o dashboard.zip \
    && unzip dashboard.zip -d webui \
    && rm dashboard.zip

# 安装依赖
RUN --mount=type=cache,target=/root/.cache/uv \
    uv pip install 'setuptools<82' \
    && uv pip install -r requirements.txt

RUN mkdir plugins && mkdir data

RUN --mount=type=cache,target=/root/.cache/uv \
    git clone --depth 1 https://github.com/lxfight/astrbot_plugin_mnemosyne plugins/astrbot_plugin_mnemosyne \
    && rm -rf plugins/astrbot_plugin_mnemosyne/.git \
    && uv pip install -r plugins/astrbot_plugin_mnemosyne/requirements.txt

RUN --mount=type=cache,target=/root/.cache/uv \
    git clone --depth 1 https://github.com/anka-afk/astrbot_plugin_meme_manager plugins/astrbot_plugin_meme_manager \
    && rm -rf plugins/astrbot_plugin_meme_manager/.git \
    && uv pip install -r plugins/astrbot_plugin_meme_manager/requirements.txt

RUN --mount=type=cache,target=/root/.cache/uv \
    git clone --depth 1 https://github.com/zouyonghe/astrbot_plugin_web_searcher_pro plugins/astrbot_plugin_web_searcher_pro \
    && rm -rf plugins/astrbot_plugin_web_searcher_pro/.git \
    && uv pip install -r plugins/astrbot_plugin_web_searcher_pro/requirements.txt

RUN --mount=type=cache,target=/root/.cache/uv \
    git clone --depth 1 https://github.com/DBJD-CR/astrbot_plugin_proactive_chat plugins/astrbot_plugin_proactive_chat \
    && rm -rf plugins/astrbot_plugin_proactive_chat/.git \
    && uv pip install -r plugins/astrbot_plugin_proactive_chat/requirements.txt

RUN printf '%s\n' \
    '#!/bin/sh' \
    'set -e' \
    'cd /app' \
    'ln -sfT /app/plugins /app/data/plugins' \
    'exec "$@"' \
    > /usr/local/bin/docker-entrypoint.sh \
    && chmod +x /usr/local/bin/docker-entrypoint.sh

EXPOSE 6185
VOLUME [ "/app/data" ]
ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD [ "python", "main.py", "--webui-dir", "webui/dist" ]

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 astrbot 镜像标签

docker pull docker.xuanyuan.run/mioyisama/astrbot:<标签>

DockerHub 原生拉取命令

docker pull mioyisama/astrbot:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告