From a911bc9fad0b148e59c60130f1d87b0d0ef6306c Mon Sep 17 00:00:00 2001 From: infinitycat Date: Mon, 18 Aug 2025 18:31:07 +0800 Subject: [PATCH 1/6] test: test Dockfile --- Dockerfile | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index be76277c..d6553dbc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ FROM python:3.13.5-slim-bookworm COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +EXPOSE 8000 + +# 编译器 +RUN RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* +RUN uv pip install --system --upgrade pip Cython py-cpuinfo setuptools # 工作目录 WORKDIR /MaiMBot @@ -10,23 +15,15 @@ COPY requirements.txt . #COPY maim_message /maim_message COPY MaiMBot-LPMM /MaiMBot-LPMM -# 编译器 -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 pip install --system -e /maim_message RUN uv pip install --system -r requirements.txt # 复制项目代码 COPY . . -EXPOSE 8000 - -ENTRYPOINT [ "python","bot.py" ] \ No newline at end of file +ENTRYPOINT [ "python","bot.py" ] From 9c8a34ce244b24c00920f352d5e8105b0a48df0d Mon Sep 17 00:00:00 2001 From: infinitycat Date: Mon, 18 Aug 2025 18:36:55 +0800 Subject: [PATCH 2/6] test: test Dockfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d6553dbc..af4a6e1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ EXPOSE 8000 # 编译器 -RUN RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* RUN uv pip install --system --upgrade pip Cython py-cpuinfo setuptools # 工作目录 From aea806d8b50d584494264315e621fb0b3932622e Mon Sep 17 00:00:00 2001 From: infinitycat Date: Mon, 18 Aug 2025 18:59:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?perf(Dockerfile):=20=E6=9B=B4=E6=96=B0deb?= =?UTF-8?q?=EF=BC=8Cpy=E7=89=88=E6=9C=AC=EF=BC=8C=E4=BC=98=E5=8C=96Dockerf?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index af4a6e1c..10b2681d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,30 @@ -FROM python:3.13.5-slim-bookworm +FROM python:3.13.7-slim-trixie COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ -EXPOSE 8000 - -# 编译器 -RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* -RUN uv pip install --system --upgrade pip Cython py-cpuinfo setuptools # 工作目录 WORKDIR /MaiMBot # 复制依赖列表 COPY requirements.txt . -# 同级目录下需要有 maim_message MaiMBot-LPMM -#COPY maim_message /maim_message +# 同级目录下需要有 MaiMBot-LPMM COPY MaiMBot-LPMM /MaiMBot-LPMM +# 编译器 +RUN apt-get update && apt-get install -y build-essential +RUN uv pip install --system --upgrade pip + # 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 -e /maim_message RUN uv pip install --system -r requirements.txt # 复制项目代码 COPY . . +EXPOSE 8000 + ENTRYPOINT [ "python","bot.py" ] From b91246ffc596505f9557f159570cb17a3139ce3c Mon Sep 17 00:00:00 2001 From: infinitycat Date: Fri, 7 Nov 2025 09:03:33 +0800 Subject: [PATCH 4/6] =?UTF-8?q?test(docker):=20=E5=88=86=E6=AE=B5=E6=9E=84?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 2 +- Dockerfile | 36 +++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.dockerignore b/.dockerignore index a81a6821..15c09fbf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,4 +7,4 @@ mongodb napcat docs/ .github/ -# test +# test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 10b2681d..dafcd281 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,23 @@ -FROM python:3.13.7-slim-trixie +# 编译 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 +RUN uv pip install --system Cython py-cpuinfo setuptools + +# 编译 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/ # 工作目录 @@ -6,20 +25,11 @@ WORKDIR /MaiMBot # 复制依赖列表 COPY requirements.txt . -# 同级目录下需要有 MaiMBot-LPMM -COPY MaiMBot-LPMM /MaiMBot-LPMM -# 编译器 -RUN apt-get update && apt-get install -y build-essential -RUN uv pip install --system --upgrade pip +# 从编译阶段复制 LPMM 编译结果 +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 -r requirements.txt # 复制项目代码 From 45df8b4b7528b0006c502ac0173910867fc1ba27 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Fri, 7 Nov 2025 09:23:59 +0800 Subject: [PATCH 5/6] =?UTF-8?q?test(docker):=20=E5=88=86=E6=AE=B5=E6=9E=84?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index dafcd281..df1c6701 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ COPY requirements.txt . 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 -r requirements.txt # 复制项目代码 From 8c285c92e0431e7d60d82cd7a008b6c0334193e4 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Fri, 7 Nov 2025 09:32:31 +0800 Subject: [PATCH 6/6] =?UTF-8?q?feat(docker):=20=E4=BC=98=E5=8C=96docker?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index df1c6701..b0f3775f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ 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 -RUN uv pip install --system Cython py-cpuinfo setuptools # 编译 LPMM RUN cd /MaiMBot-LPMM/lib/quick_algo && python build_lib.py --cleanup --cythonize --install