From 08982e482bd5ff13d58f3eeb998c7c3df9768398 Mon Sep 17 00:00:00 2001 From: Wang Defa Date: Mon, 15 Dec 2025 12:48:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Ubuntu=20=E6=94=B9=E7=94=A8=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E9=93=BE=E6=8E=A5=E4=BB=A5=E9=81=BF=E5=85=8D=E5=A4=8D?= =?UTF-8?q?=E6=9D=82=E7=9A=84=E9=9D=99=E6=80=81=E9=93=BE=E6=8E=A5=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 -DSTATIC=ON,使用动态链接 - 最终镜像从 scratch 改为 ubuntu:22.04 - 添加所有必需的运行时依赖库 静态链接 Ubuntu 上的 libunbound 需要手动构建多个依赖库(libevent、 nettle、gmp、hogweed),过于复杂且不稳定。动态链接是更实用的方案。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- docker/Dockerfile.ubuntu | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index 96ff7dc..2b7ed8e 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -51,18 +51,37 @@ COPY ./init.sh ./init.sh RUN chmod +x ./init.sh && ./init.sh -# 构建 Monero (mond) 使用 release-static 目标 +# 构建 Monero (mond) - 使用动态链接 RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \ - MAKE_JOBS=2; \ + MAKE_JOBS="-j2"; \ else \ - MAKE_JOBS=$(nproc); \ + MAKE_JOBS="-j$(nproc)"; \ fi && \ echo "Building with parallel jobs: $MAKE_JOBS" && \ - make -j$MAKE_JOBS release-static + mkdir -p build/release && cd build/release && \ + cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI_DEPS=OFF -DARCH=default && \ + make $MAKE_JOBS daemon -# 最终阶段 - 只复制二进制文件 -FROM scratch +# 最终阶段 - 使用 Ubuntu 基础镜像以支持动态链接 +FROM ubuntu:22.04 ARG TARGETARCH +# 安装运行时依赖 +RUN apt-get update && apt-get install -y \ + libboost-chrono1.74.0 \ + libboost-filesystem1.74.0 \ + libboost-program-options1.74.0 \ + libboost-serialization1.74.0 \ + libboost-system1.74.0 \ + libboost-thread1.74.0 \ + libssl3 \ + libzmq5 \ + libunbound8 \ + libsodium23 \ + libunwind8 \ + libreadline8 \ + libhidapi-libusb0 \ + && rm -rf /var/lib/apt/lists/* + COPY --from=build /monero/build/release/bin/mond /linux_${TARGETARCH}/mond