From c7ba0bfde057301cf36c798e5d8450218da3c141 Mon Sep 17 00:00:00 2001 From: zhinianboke <115088296+zhinianboke@users.noreply.github.com> Date: Sat, 27 Sep 2025 20:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 12 ++++++++++++ Dockerfile-cn | 12 ++++++++++++ build_binary_module.py | 3 +++ 3 files changed, 27 insertions(+) diff --git a/Dockerfile b/Dockerfile index d1190a5..1940f75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,14 @@ RUN apt-get update && \ # 基础工具 nodejs \ npm \ + build-essential \ + gcc \ + g++ \ + make \ + pkg-config \ + patchelf \ + git \ + tzdata \ curl \ ca-certificates \ @@ -73,6 +81,10 @@ RUN apt-get update && \ && rm -rf /tmp/* \ && rm -rf /var/tmp/* +# 降低编译内存占用(针对 Nuitka 构建阶段) +ENV CFLAGS="-O1" \ + CXXFLAGS="-O1" + # 设置时区 RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone diff --git a/Dockerfile-cn b/Dockerfile-cn index c19e417..5b61fce 100644 --- a/Dockerfile-cn +++ b/Dockerfile-cn @@ -31,6 +31,14 @@ RUN apt-get update && \ # 基础工具 nodejs \ npm \ + build-essential \ + gcc \ + g++ \ + make \ + pkg-config \ + patchelf \ + git \ + tzdata \ curl \ ca-certificates \ @@ -76,6 +84,10 @@ RUN apt-get update && \ # 设置时区 RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +# 降低编译内存占用(针对 Nuitka 构建阶段) +ENV CFLAGS="-O1" \ + CXXFLAGS="-O1" + # 验证Node.js安装并设置环境变量 RUN node --version && npm --version diff --git a/build_binary_module.py b/build_binary_module.py index 94034c8..d56d958 100644 --- a/build_binary_module.py +++ b/build_binary_module.py @@ -38,6 +38,9 @@ def build(): "--python-flag=no_docstrings", "--python-flag=no_warnings", "--enable-plugin=anti-bloat", + # 降低内存占用,避免容器内 OOM + "--lto=no", + "--jobs=1", str(SRC) ]