All checks were successful
Build and Release Mond / build-and-test (arm64, alpine) (push) Successful in 26s
Build and Release Mond / build-and-test (amd64, alpine) (push) Successful in 39s
Build and Release Mond / build-and-test (arm64, ubuntu) (push) Successful in 44s
Build and Release Mond / build-and-test (amd64, ubuntu) (push) Successful in 1m2s
Build and Release Mond / release (push) Has been skipped
- 移除 -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 <noreply@anthropic.com>
88 lines
2.0 KiB
Docker
88 lines
2.0 KiB
Docker
FROM ubuntu:22.04 AS base
|
|
|
|
ARG TARGETARCH
|
|
ARG BUILDPLATFORM
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# 安装构建依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
wget \
|
|
build-essential \
|
|
cmake \
|
|
pkg-config \
|
|
libboost-all-dev \
|
|
libssl-dev \
|
|
libzmq3-dev \
|
|
libunbound-dev \
|
|
libsodium-dev \
|
|
libunwind8-dev \
|
|
liblzma-dev \
|
|
libreadline-dev \
|
|
libexpat1-dev \
|
|
libpgm-dev \
|
|
qttools5-dev-tools \
|
|
libhidapi-dev \
|
|
libusb-1.0-0-dev \
|
|
libprotobuf-dev \
|
|
protobuf-compiler \
|
|
libudev-dev \
|
|
libgtest-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
FROM base AS build
|
|
|
|
ARG MONERO_VERSION=v0.18.3.4
|
|
ARG TARGETARCH
|
|
ARG BUILDPLATFORM
|
|
ARG TARGETPLATFORM
|
|
|
|
# 克隆 Monero 项目
|
|
RUN git clone --recursive https://github.com/monero-project/monero.git && \
|
|
cd monero && \
|
|
git checkout ${MONERO_VERSION} && \
|
|
git submodule update --init --force
|
|
|
|
WORKDIR /monero
|
|
|
|
# 复制并运行 init.sh 脚本进行修改
|
|
COPY ./init.sh ./init.sh
|
|
|
|
RUN chmod +x ./init.sh && ./init.sh
|
|
|
|
# 构建 Monero (mond) - 使用动态链接
|
|
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
|
|
MAKE_JOBS="-j2"; \
|
|
else \
|
|
MAKE_JOBS="-j$(nproc)"; \
|
|
fi && \
|
|
echo "Building with parallel jobs: $MAKE_JOBS" && \
|
|
mkdir -p build/release && cd build/release && \
|
|
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI_DEPS=OFF -DARCH=default && \
|
|
make $MAKE_JOBS daemon
|
|
|
|
# 最终阶段 - 使用 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
|