pull/1348/head
SengokuCola 2025-11-07 15:27:09 +08:00
commit bf2ab6759c
2 changed files with 24 additions and 16 deletions

View File

@ -7,4 +7,4 @@ mongodb
napcat napcat
docs/ docs/
.github/ .github/
# test # test

View File

@ -1,4 +1,22 @@
FROM python:3.13.5-slim-bookworm # 编译 LPMM
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
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# 工作目录 # 工作目录
@ -6,22 +24,12 @@ WORKDIR /MaiMBot
# 复制依赖列表 # 复制依赖列表
COPY requirements.txt . COPY requirements.txt .
# 同级目录下需要有 maim_message MaiMBot-LPMM
#COPY maim_message /maim_message
COPY MaiMBot-LPMM /MaiMBot-LPMM
# 编译器 # 从编译阶段复制 LPMM 编译结果
RUN apt-get update && apt-get install -y build-essential COPY --from=lpmm-builder /usr/local/lib/python3.13/site-packages/ /usr/local/lib/python3.13/site-packages/
# 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 pip install --system --upgrade pip
#RUN uv pip install --system -e /maim_message
RUN uv pip install --system -r requirements.txt RUN uv pip install --system -r requirements.txt
# 复制项目代码 # 复制项目代码
@ -29,4 +37,4 @@ COPY . .
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT [ "python","bot.py" ] ENTRYPOINT [ "python","bot.py" ]