docker:不再编译lpmm,适配器改为插件
This commit is contained in:
6
.github/workflows/docker-image-dev.yml
vendored
6
.github/workflows/docker-image-dev.yml
vendored
@@ -30,9 +30,6 @@ jobs:
|
|||||||
# - name: Clone maim_message
|
# - name: Clone maim_message
|
||||||
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -84,9 +81,6 @@ jobs:
|
|||||||
# - name: Clone maim_message
|
# - name: Clone maim_message
|
||||||
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
6
.github/workflows/docker-image-main.yml
vendored
6
.github/workflows/docker-image-main.yml
vendored
@@ -34,9 +34,6 @@ jobs:
|
|||||||
# - name: Clone maim_message
|
# - name: Clone maim_message
|
||||||
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -87,9 +84,6 @@ jobs:
|
|||||||
# - name: Clone maim_message
|
# - name: Clone maim_message
|
||||||
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
# run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/Mai-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
35
Dockerfile
35
Dockerfile
@@ -1,44 +1,27 @@
|
|||||||
# 编译 LPMM
|
# Runtime image
|
||||||
FROM python:3.13-slim AS lpmm-builder
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
||||||
|
|
||||||
WORKDIR /MaiMBot-LPMM
|
|
||||||
|
|
||||||
# 同级目录下需要有 MaiMBot-LPMM
|
|
||||||
COPY MaiMBot-LPMM /MaiMBot-LPMM
|
|
||||||
|
|
||||||
# 安装编译器和编译依赖
|
|
||||||
RUN apt-get update && apt-get install -y build-essential
|
|
||||||
RUN uv pip install --system --upgrade pip
|
|
||||||
RUN cd /MaiMBot-LPMM && uv pip install --system -r requirements.txt
|
|
||||||
|
|
||||||
# 编译 LPMM
|
|
||||||
RUN cd /MaiMBot-LPMM/lib/quick_algo && python build_lib.py --cleanup --cythonize --install
|
|
||||||
|
|
||||||
# 运行环境
|
|
||||||
FROM python:3.13-slim
|
FROM python:3.13-slim
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
# 工作目录
|
# Working directory
|
||||||
WORKDIR /MaiMBot
|
WORKDIR /MaiMBot
|
||||||
|
|
||||||
ENV MAIBOT_LEGACY_0X_UPGRADE_CONFIRMED=1
|
ENV MAIBOT_LEGACY_0X_UPGRADE_CONFIRMED=1
|
||||||
|
|
||||||
# 复制依赖列表
|
# Copy dependency list
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y git
|
RUN apt-get update && apt-get install -y git
|
||||||
|
|
||||||
# 从编译阶段复制 LPMM 编译结果
|
# Install runtime dependencies
|
||||||
COPY --from=lpmm-builder /usr/local/lib/python3.13/site-packages/ /usr/local/lib/python3.13/site-packages/
|
|
||||||
|
|
||||||
# 安装运行时依赖
|
|
||||||
RUN uv pip install --system --upgrade pip
|
RUN uv pip install --system --upgrade pip
|
||||||
RUN uv pip install --system -r requirements.txt
|
RUN uv pip install --system -r requirements.txt
|
||||||
|
|
||||||
# 复制项目代码
|
# Copy project source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN git clone --depth 1 --branch plugin https://github.com/Mai-with-u/MaiBot-Napcat-Adapter.git plugin-templates/MaiBot-Napcat-Adapter
|
||||||
|
RUN chmod +x docker-entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
ENTRYPOINT [ "python","bot.py" ]
|
ENTRYPOINT [ "./docker-entrypoint.sh" ]
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
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: maim-bot-core
|
||||||
#### prod ####
|
#### prod ####
|
||||||
@@ -36,7 +18,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# 监听地址和端口已迁移到 ./docker-config/mmc/bot_config.toml 的 maim_message 与 webui 配置段
|
# 监听地址和端口已迁移到 ./docker-config/mmc/bot_config.toml 的 maim_message 与 webui 配置段
|
||||||
- ./docker-config/mmc:/MaiMBot/config # 持久化bot配置文件
|
- ./docker-config/mmc:/MaiMBot/config # 持久化bot配置文件
|
||||||
- ./docker-config/adapters:/MaiMBot/adapters-config # adapter配置文件夹映射
|
|
||||||
- ./data/MaiMBot/maibot_statistics.html:/MaiMBot/maibot_statistics.html #统计数据输出
|
- ./data/MaiMBot/maibot_statistics.html:/MaiMBot/maibot_statistics.html #统计数据输出
|
||||||
- ./data/MaiMBot:/MaiMBot/data # 共享目录
|
- ./data/MaiMBot:/MaiMBot/data # 共享目录
|
||||||
- ./data/MaiMBot/plugins:/MaiMBot/plugins # 插件目录
|
- ./data/MaiMBot/plugins:/MaiMBot/plugins # 插件目录
|
||||||
|
|||||||
13
docker-entrypoint.sh
Normal file
13
docker-entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
ADAPTER_TEMPLATE="/MaiMBot/plugin-templates/MaiBot-Napcat-Adapter"
|
||||||
|
ADAPTER_TARGET="/MaiMBot/plugins/MaiBot-Napcat-Adapter"
|
||||||
|
|
||||||
|
mkdir -p /MaiMBot/plugins
|
||||||
|
|
||||||
|
if [ ! -e "$ADAPTER_TARGET" ] && [ -d "$ADAPTER_TEMPLATE" ]; then
|
||||||
|
cp -a "$ADAPTER_TEMPLATE" "$ADAPTER_TARGET"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec python bot.py "$@"
|
||||||
Reference in New Issue
Block a user