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) ]