fix: 使用 Ubuntu 20.04 和官方 depends 系统实现静态链接
All checks were successful
Build and Release Mond / build-and-test (arm64, alpine) (push) Successful in 25s
Build and Release Mond / build-and-test (amd64, alpine) (push) Successful in 37s
Build and Release Mond / build-and-test (amd64, ubuntu) (push) Successful in 17m29s
Build and Release Mond / build-and-test (arm64, ubuntu) (push) Successful in 21m6s
Build and Release Mond / release (push) Has been skipped
All checks were successful
Build and Release Mond / build-and-test (arm64, alpine) (push) Successful in 25s
Build and Release Mond / build-and-test (amd64, alpine) (push) Successful in 37s
Build and Release Mond / build-and-test (amd64, ubuntu) (push) Successful in 17m29s
Build and Release Mond / build-and-test (arm64, ubuntu) (push) Successful in 21m6s
Build and Release Mond / release (push) Has been skipped
关键问题修复: - Ubuntu 22.04 的 GCC 11.4 与 Boost 1.69 不兼容 - Ubuntu 20.04 的 GCC 9.x 与 Boost 1.69 完全兼容 核心改进: 1. 基础镜像从 ubuntu:22.04 改为 ubuntu:20.04 2. 使用官方 Dockerfile 的 depends 系统方法 3. 构建产物路径对齐官方:build/TARGET/release/bin/mond 4. 支持 amd64 和 arm64 架构
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:22.04 AS base
|
FROM ubuntu:20.04 AS base
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG BUILDPLATFORM
|
ARG BUILDPLATFORM
|
||||||
@@ -59,25 +59,25 @@ COPY ./init.sh ./init.sh
|
|||||||
|
|
||||||
RUN chmod +x ./init.sh && ./init.sh
|
RUN chmod +x ./init.sh && ./init.sh
|
||||||
|
|
||||||
# 构建 Monero (mond) - 使用官方 release-static 方法
|
# 使用官方 depends 系统构建静态依赖(参考 .source/Dockerfile)
|
||||||
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
|
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
|
||||||
MAKE_JOBS="-j2"; \
|
MAKE_JOBS=2; \
|
||||||
else \
|
else \
|
||||||
MAKE_JOBS="-j$(nproc)"; \
|
MAKE_JOBS=$(nproc); \
|
||||||
fi && \
|
fi && \
|
||||||
echo "Building mond with parallel jobs: $MAKE_JOBS" && \
|
if [ "$TARGETARCH" = "arm64" ]; then \
|
||||||
mkdir -p build/release && cd build/release && \
|
DEPENDS_TARGET="aarch64-linux-gnu"; \
|
||||||
cmake ../.. \
|
else \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
DEPENDS_TARGET="x86_64-linux-gnu"; \
|
||||||
-DBUILD_GUI_DEPS=OFF \
|
fi && \
|
||||||
-DARCH=default \
|
echo "Building dependencies for $DEPENDS_TARGET with $MAKE_JOBS parallel jobs" && \
|
||||||
-DSTATIC=ON \
|
make -j$MAKE_JOBS depends target=$DEPENDS_TARGET && \
|
||||||
-DSTACK_TRACE=OFF && \
|
mkdir -p /output && \
|
||||||
make $MAKE_JOBS daemon
|
cp build/$DEPENDS_TARGET/release/bin/mond /output/mond
|
||||||
|
|
||||||
# 最终阶段 - 只复制静态链接的二进制文件
|
# 最终阶段 - 只复制静态链接的二进制文件
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
COPY --from=build /monero/build/release/bin/mond /linux_${TARGETARCH}/mond
|
COPY --from=build /output/mond /linux_${TARGETARCH}/mond
|
||||||
|
|||||||
Reference in New Issue
Block a user