Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
This commit is contained in:
156
.github/workflows/docker-image.yml
vendored
156
.github/workflows/docker-image.yml
vendored
@@ -1,70 +1,51 @@
|
|||||||
name: Docker CI
|
name: Docker Build and Push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# push:
|
push:
|
||||||
# branches:
|
branches:
|
||||||
# - master
|
- master
|
||||||
# - develop
|
- dev
|
||||||
# tags:
|
tags:
|
||||||
# - "v*.*.*"
|
- "v*.*.*"
|
||||||
# - "v*"
|
- "v*"
|
||||||
# - "*.*.*"
|
- "*.*.*"
|
||||||
# - "*.*.*-*"
|
- "*.*.*-*"
|
||||||
workflow_dispatch: # 允许手动触发工作流
|
workflow_dispatch: # 允许手动触发工作流
|
||||||
|
|
||||||
|
# Workflow's jobs
|
||||||
jobs:
|
jobs:
|
||||||
build-amd64:
|
build-amd64:
|
||||||
name: 构建 AMD64 镜像
|
name: Build AMD64 Image
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
digest: ${{ steps.build.outputs.digest }}
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
steps:
|
steps:
|
||||||
- name: 检出 Git 仓库
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: 克隆 maim_message
|
- name: Set up Docker Buildx
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: MaiM-with-u/maim_message
|
|
||||||
path: maim_message
|
|
||||||
|
|
||||||
- name: 克隆 MaiMBot-LPMM
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: MaiM-with-u/MaiMBot-LPMM
|
|
||||||
path: MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: 设置 Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
buildkitd-flags: --debug
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
- name: 登录到 Docker Hub
|
# Log in docker hub
|
||||||
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Docker 元数据
|
# Generate metadata for Docker images
|
||||||
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/mofox
|
||||||
|
|
||||||
- name: 动态生成镜像标签
|
# Build and push AMD64 image by digest
|
||||||
id: tag
|
- name: Build and push AMD64
|
||||||
run: |
|
|
||||||
if [ "$GITHUB_REF" == "refs/heads/master" ]; then
|
|
||||||
echo "tag=latest" >> $GITHUB_ENV
|
|
||||||
elif [ "$GITHUB_REF" == "refs/heads/develop" ]; then
|
|
||||||
echo "tag=dev" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "tag=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 构建并推送 AMD64 镜像
|
|
||||||
id: build
|
id: build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
@@ -72,10 +53,97 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache
|
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/mofox:amd64-buildcache
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache,mode=max
|
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/mofox:amd64-buildcache,mode=max
|
||||||
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot:${{ env.tag }},name-canonical=true,push=true
|
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/mofox,push-by-digest=true,name-canonical=true,push=true
|
||||||
build-args: |
|
build-args: |
|
||||||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
VCS_REF=${{ github.sha }}
|
VCS_REF=${{ github.sha }}
|
||||||
BRANCH_NAME=${{ github.ref_name }}
|
|
||||||
|
build-arm64:
|
||||||
|
name: Build ARM64 Image
|
||||||
|
runs-on: ubuntu-24.04-arm
|
||||||
|
outputs:
|
||||||
|
digest: ${{ steps.build.outputs.digest }}
|
||||||
|
steps:
|
||||||
|
- name: Check out git repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
|
# Log in docker hub
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Generate metadata for Docker images
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/mofox
|
||||||
|
|
||||||
|
# Build and push ARM64 image by digest
|
||||||
|
- name: Build and push ARM64
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/arm64/v8
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/mofox:arm64-buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/mofox:arm64-buildcache,mode=max
|
||||||
|
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/mofox,push-by-digest=true,name-canonical=true,push=true
|
||||||
|
build-args: |
|
||||||
|
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
VCS_REF=${{ github.sha }}
|
||||||
|
|
||||||
|
create-manifest:
|
||||||
|
name: Create Multi-Arch Manifest
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs:
|
||||||
|
- build-amd64
|
||||||
|
- build-arm64
|
||||||
|
steps:
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# Log in docker hub
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Generate metadata for Docker images
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKERHUB_USERNAME }}/mofox
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=tag
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha,prefix=${{ github.ref_name }}-,enable=${{ github.ref_type == 'branch' }}
|
||||||
|
|
||||||
|
- name: Create and Push Manifest
|
||||||
|
run: |
|
||||||
|
# 为每个标签创建多架构镜像
|
||||||
|
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' '); do
|
||||||
|
echo "Creating manifest for $tag"
|
||||||
|
docker buildx imagetools create -t $tag \
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/mofox@${{ needs.build-amd64.outputs.digest }} \
|
||||||
|
${{ secrets.DOCKERHUB_USERNAME }}/mofox@${{ needs.build-arm64.outputs.digest }}
|
||||||
|
done
|
||||||
20
Dockerfile
20
Dockerfile
@@ -2,31 +2,19 @@ FROM python:3.13.5-slim-bookworm
|
|||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
# 工作目录
|
# 工作目录
|
||||||
WORKDIR /mmc
|
WORKDIR /app
|
||||||
|
|
||||||
# 复制依赖列表
|
# 复制依赖列表
|
||||||
COPY requirements.txt .
|
COPY pyproject.toml .
|
||||||
# 同级目录下需要有 maim_message MaiMBot-LPMM
|
|
||||||
#COPY maim_message /maim_message
|
|
||||||
COPY MaiMBot-LPMM /MaiMBot-LPMM
|
|
||||||
|
|
||||||
# 编译器
|
# 编译器
|
||||||
RUN apt-get update && apt-get install -y build-essential
|
RUN apt-get update && apt-get install -y build-essential
|
||||||
|
|
||||||
# lpmm编译安装
|
|
||||||
RUN cd /MaiMBot-LPMM && uv pip install --system -r requirements.txt
|
|
||||||
RUN uv pip install --system Cython py-cpuinfo setuptools
|
|
||||||
RUN cd /MaiMBot-LPMM/lib/quick_algo && python build_lib.py --cleanup --cythonize --install
|
|
||||||
|
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
RUN uv pip install --system --upgrade pip
|
RUN uv sync
|
||||||
#RUN uv pip install --system -e /maim_message
|
|
||||||
RUN uv pip install --system -r requirements.txt
|
|
||||||
|
|
||||||
# 复制项目代码
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
ENTRYPOINT [ "python","bot.py" ]
|
ENTRYPOINT [ "uv","run","bot.py" ]
|
||||||
@@ -1,47 +1,22 @@
|
|||||||
services:
|
services:
|
||||||
adapters:
|
|
||||||
container_name: maim-bot-adapters
|
|
||||||
#### prod ####
|
|
||||||
image: unclas/maimbot-adapter:latest
|
|
||||||
# image: infinitycat/maimbot-adapter:latest
|
|
||||||
#### dev ####
|
|
||||||
# image: unclas/maimbot-adapter:dev
|
|
||||||
# image: infinitycat/maimbot-adapter:dev
|
|
||||||
environment:
|
|
||||||
- TZ=Asia/Shanghai
|
|
||||||
# ports:
|
|
||||||
# - "8095:8095"
|
|
||||||
volumes:
|
|
||||||
- ./docker-config/adapters/config.toml:/adapters/config.toml # 持久化adapters配置文件
|
|
||||||
- ./data/adapters:/adapters/data # adapters 数据持久化
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- maim_bot
|
|
||||||
core:
|
core:
|
||||||
container_name: maim-bot-core
|
container_name: MoFox-Bot
|
||||||
#### prod ####
|
#### prod ####
|
||||||
image: sengokucola/maibot:latest
|
image: hunuon/mofox:latest
|
||||||
# image: infinitycat/maibot:latest
|
|
||||||
#### dev ####
|
#### dev ####
|
||||||
# image: sengokucola/maibot:dev
|
# image: hunuon/mofox:dev
|
||||||
# image: infinitycat/maibot:dev
|
|
||||||
environment:
|
environment:
|
||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
# - EULA_AGREE=99f08e0cab0190de853cb6af7d64d4de # 同意EULA
|
|
||||||
# - PRIVACY_AGREE=9943b855e72199d0f5016ea39052f1b6 # 同意EULA
|
|
||||||
# ports:
|
|
||||||
# - "8000:8000"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker-config/mmc/.env:/MaiMBot/.env # 持久化env配置文件
|
- ./docker-config/core/.env:/app/.env # 持久化env配置文件
|
||||||
- ./docker-config/mmc:/MaiMBot/config # 持久化bot配置文件
|
- ./docker-config/core:/app/config # 持久化bot配置文件
|
||||||
- ./data/MaiMBot/maibot_statistics.html:/MaiMBot/maibot_statistics.html #统计数据输出
|
- ./data/core/maibot_statistics.html:/app/maibot_statistics.html #统计数据输出
|
||||||
- ./data/MaiMBot:/MaiMBot/data # 共享目录
|
- ./data/app:/app/data # 共享目录
|
||||||
- ./data/MaiMBot/plugins:/MaiMBot/plugins # 插件目录
|
- ./data/core/plugins:/app/plugins # 插件目录
|
||||||
- ./data/MaiMBot/logs:/MaiMBot/logs # 日志目录
|
- ./data/core/logs:/app/logs # 日志目录
|
||||||
- site-packages:/usr/local/lib/python3.13/site-packages # 持久化Python包
|
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- mofox
|
||||||
napcat:
|
napcat:
|
||||||
environment:
|
environment:
|
||||||
- NAPCAT_UID=1000
|
- NAPCAT_UID=1000
|
||||||
@@ -52,25 +27,12 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./docker-config/napcat:/app/napcat/config # 持久化napcat配置文件
|
- ./docker-config/napcat:/app/napcat/config # 持久化napcat配置文件
|
||||||
- ./data/qq:/app/.config/QQ # 持久化QQ本体
|
- ./data/qq:/app/.config/QQ # 持久化QQ本体
|
||||||
- ./data/MaiMBot:/MaiMBot/data # 共享目录
|
- ./data/app:/app/data # 共享目录
|
||||||
container_name: maim-bot-napcat
|
container_name: mofox-napcat
|
||||||
restart: always
|
restart: always
|
||||||
image: mlikiowa/napcat-docker:latest
|
image: mlikiowa/napcat-docker:latest
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- mofox
|
||||||
sqlite-web:
|
|
||||||
# 注意:coleifer/sqlite-web 镜像不支持arm64
|
|
||||||
image: coleifer/sqlite-web
|
|
||||||
container_name: sqlite-web
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- "8120:8080"
|
|
||||||
volumes:
|
|
||||||
- ./data/MaiMBot:/data/MaiMBot
|
|
||||||
environment:
|
|
||||||
- SQLITE_DATABASE=MaiMBot/MaiBot.db # 你的数据库文件
|
|
||||||
networks:
|
|
||||||
- maim_bot
|
|
||||||
|
|
||||||
# chat2db占用相对较高但是功能强大
|
# chat2db占用相对较高但是功能强大
|
||||||
# 内存占用约600m,内存充足推荐选此
|
# 内存占用约600m,内存充足推荐选此
|
||||||
@@ -81,11 +43,11 @@ services:
|
|||||||
# ports:
|
# ports:
|
||||||
# - "10824:10824"
|
# - "10824:10824"
|
||||||
# volumes:
|
# volumes:
|
||||||
# - ./data/MaiMBot:/data/MaiMBot
|
# - ./data/chat2db:/data/app
|
||||||
# networks:
|
# networks:
|
||||||
# - maim_bot
|
# - mofox
|
||||||
volumes:
|
volumes:
|
||||||
site-packages:
|
site-packages:
|
||||||
networks:
|
networks:
|
||||||
maim_bot:
|
mofox:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
@@ -2,17 +2,16 @@
|
|||||||
name = "MoFox-Bot"
|
name = "MoFox-Bot"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
description = "MoFox-Bot 是一个基于大语言模型的可交互智能体"
|
description = "MoFox-Bot 是一个基于大语言模型的可交互智能体"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11,<=3.13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aiohttp>=3.12.14",
|
"aiohttp>=3.12.14",
|
||||||
"aiohttp-cors>=0.8.1",
|
"aiohttp-cors>=0.8.1",
|
||||||
"apscheduler>=3.11.0",
|
"apscheduler>=3.11.0",
|
||||||
"asyncddgs>=0.1.0a1",
|
|
||||||
"asyncio>=4.0.0",
|
"asyncio>=4.0.0",
|
||||||
"beautifulsoup4>=4.13.4",
|
"beautifulsoup4>=4.13.4",
|
||||||
"chromadb>=0.5.0",
|
"chromadb>=1.2.0",
|
||||||
"colorama>=0.4.6",
|
"colorama>=0.4.6",
|
||||||
"cryptography>=45.0.5",
|
"cryptography>=46.0.3",
|
||||||
"customtkinter>=5.2.2",
|
"customtkinter>=5.2.2",
|
||||||
"dotenv>=0.9.9",
|
"dotenv>=0.9.9",
|
||||||
"exa-py>=1.14.20",
|
"exa-py>=1.14.20",
|
||||||
@@ -21,11 +20,10 @@ dependencies = [
|
|||||||
"google>=3.0.0",
|
"google>=3.0.0",
|
||||||
"google-genai>=1.29.0",
|
"google-genai>=1.29.0",
|
||||||
"httpx>=0.28.1",
|
"httpx>=0.28.1",
|
||||||
"jieba>=0.1.13",
|
|
||||||
"json-repair>=0.47.6",
|
"json-repair>=0.47.6",
|
||||||
"json5>=0.12.1",
|
"json5>=0.12.1",
|
||||||
"jsonlines>=4.0.0",
|
"jsonlines>=4.0.0",
|
||||||
"langfuse==2.46.2",
|
"langfuse==3.7.0",
|
||||||
"lunar-python>=1.4.4",
|
"lunar-python>=1.4.4",
|
||||||
"lxml>=6.0.0",
|
"lxml>=6.0.0",
|
||||||
"maim-message>=0.3.8",
|
"maim-message>=0.3.8",
|
||||||
@@ -33,16 +31,16 @@ dependencies = [
|
|||||||
"networkx>=3.4.2",
|
"networkx>=3.4.2",
|
||||||
"orjson>=3.10",
|
"orjson>=3.10",
|
||||||
"numpy>=2.2.6",
|
"numpy>=2.2.6",
|
||||||
"openai>=1.95.0",
|
"openai>=2.5.0",
|
||||||
"opencv-python>=4.11.0.86",
|
"opencv-python>=4.11.0.86",
|
||||||
"packaging>=23.2",
|
"packaging>=25.0",
|
||||||
"pandas>=2.3.1",
|
"pandas>=2.3.1",
|
||||||
"peewee>=3.18.2",
|
"peewee>=3.18.2",
|
||||||
"pillow>=11.3.0",
|
"pillow>=12.0.0",
|
||||||
"pip-check-reqs>=2.5.5",
|
"pip-check-reqs>=2.5.5",
|
||||||
"psutil>=7.0.0",
|
"psutil>=7.0.0",
|
||||||
"pyarrow>=20.0.0",
|
"pyarrow>=21.0.0",
|
||||||
"pydantic>=2.11.7",
|
"pydantic>=2.12.3",
|
||||||
"pygments>=2.19.2",
|
"pygments>=2.19.2",
|
||||||
"pymongo>=4.13.2",
|
"pymongo>=4.13.2",
|
||||||
"pymysql>=1.1.1",
|
"pymysql>=1.1.1",
|
||||||
@@ -76,8 +74,8 @@ dependencies = [
|
|||||||
"aiosqlite>=0.21.0",
|
"aiosqlite>=0.21.0",
|
||||||
"inkfox>=0.1.1",
|
"inkfox>=0.1.1",
|
||||||
"rjieba>=0.1.13",
|
"rjieba>=0.1.13",
|
||||||
"mcp>=0.9.0",
|
"mcp>=1.18.0",
|
||||||
"sse-starlette>=2.2.1",
|
"sse-starlette>=3.0.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[tool.uv.index]]
|
[[tool.uv.index]]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
|
||||||
import orjson
|
import orjson
|
||||||
from json_repair import repair_json
|
from json_repair import repair_json
|
||||||
|
|||||||
Reference in New Issue
Block a user