Files
mond/docker/Dockerfile
T
wangdefa 596ffc1567
CI / validate (push) Successful in 5s
CI / build (amd64) (push) Successful in 3m38s
CI / build (arm64) (push) Successful in 8m39s
Release / build (amd64) (push) Successful in 3m35s
Release / build (arm64) (push) Successful in 8m58s
Release / release (push) Successful in 42s
feat: 重构 CI/CD 流水线,拆分为独立的构建和发布流程,更新相关文档和脚本
- 新增 .gitea/workflows/ci.yml,包含版本校验、构建和冒烟测试
- 新增 .gitea/workflows/release.yml,处理 tag 发布,上传包到仓库并创建 Release
- 更新 README.md 和 CLAUDE.md,描述新的 CI/CD 流程和版本号约定
- 修改 init.sh,增加对关键锚点的检查,确保源码结构一致性
- 更新 Dockerfile,使用 OpenSSL 3.0.21 和 unbound 1.25.1,确保与 Monero 版本一致
- 更新 build-deb.sh 示例,反映最新版本号
- 新增 VERSION 文件,统一版本管理
2026-08-07 09:51:47 +08:00

67 lines
3.7 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# musl fully-static 构建 mond(monerod 换名):手编 5 个静态库 + patch CMakeLists + static-pie。
# 为何 musl 而非 glibc:musl 的 getaddrinfo 自包含,全静态可跨发行版运行;glibc 静态会因 NSS
# 运行时 dlopen 失败(DNS error: resource busy or locked)。详见 CLAUDE.md。
# 产物为 static-pie(Alpine gcc 默认 PIE),零外部依赖,可在 glibc/musl 任意发行版直接运行。
# ---- Stage 1: 静态依赖库(版本固定 → Docker 层缓存,源码不变不重编)----
FROM alpine:3.23 AS deps
RUN apk add --no-cache g++ gcc make cmake git linux-headers autoconf automake libtool \
pkgconf perl wget tar xz bzip2 file flex bison boost-static boost-dev rapidjson-dev
ENV CFLAGS="-fPIC -O2" CXXFLAGS="-fPIC -O2"
WORKDIR /deps
# OpenSSL 3.0.21(与 Monero v0.18.5.1 depends 对齐;Alpine 仓库只有 .so,须源码编静态)
RUN wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.21/openssl-3.0.21.tar.gz && \
tar xf openssl-3.0.21.tar.gz && cd openssl-3.0.21 && \
if [ "$(uname -m)" = aarch64 ]; then OSSL_T=linux-aarch64; else OSSL_T=linux-x86_64; fi && \
./Configure no-shared no-tests --prefix=/usr --libdir=lib $OSSL_T && \
make -j"$(nproc)" && make install_sw && cd / && rm -rf /deps/openssl-3.0.21*
# libsodium 1.0.20
RUN wget -q https://download.libsodium.org/libsodium/releases/libsodium-1.0.20.tar.gz && \
tar xf libsodium-1.0.20.tar.gz && cd libsodium-1.0.20 && \
./configure --enable-static --disable-shared --prefix=/usr && \
make -j"$(nproc)" && make install && cd / && rm -rf /deps/libsodium-1.0.20*
# libzmq 4.3.5
RUN wget -q https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz && \
tar xf zeromq-4.3.5.tar.gz && cd zeromq-4.3.5 && \
./configure --enable-static --disable-shared --prefix=/usr --without-docs --enable-drafts=no && \
make -j"$(nproc)" && make install && cd / && rm -rf /deps/zeromq-4.3.5*
# expat 2.6.4
RUN wget -q https://github.com/libexpat/libexpat/releases/download/R_2_6_4/expat-2.6.4.tar.bz2 && \
tar xf expat-2.6.4.tar.bz2 && cd expat-2.6.4 && \
./configure --enable-static --disable-shared --prefix=/usr && \
make -j"$(nproc)" && make install && cd / && rm -rf /deps/expat-2.6.4*
# unbound 1.25.1(DNSSEC,与 Monero v0.18.5.1 depends 对齐)
RUN wget -q https://www.nlnetlabs.nl/downloads/unbound/unbound-1.25.1.tar.gz && \
tar xf unbound-1.25.1.tar.gz && cd unbound-1.25.1 && \
./configure --disable-shared --enable-static --prefix=/usr --with-libexpat=/usr --with-ssl=/usr \
--with-libevent=no --without-pythonmodule --without-pyunbound --with-libunbound-only --with-pic && \
make -j"$(nproc)" && make install && cd / && rm -rf /deps/unbound*
# ---- Stage 2: 换名 + patch + 编译 mond ----
FROM deps AS build
ARG MONERO_VERSION
ARG TARGETARCH
WORKDIR /src
RUN git clone --recursive --branch "${MONERO_VERSION}" --depth 1 --shallow-submodules \
https://github.com/monero-project/monero.git monero
WORKDIR /src/monero
# init.sh:monero→mond 换名 + musl fully-static patch(去 -pie、STATIC_FLAGS 改 -static)
COPY ./init.sh ./init.sh
RUN sh ./init.sh
RUN if [ "$TARGETARCH" = "arm64" ]; then MARCH=armv8-a; MTAG=linux-armv8; \
else MARCH=x86-64; MTAG=linux-x64; fi && \
cmake -S . -B build/release -DSTATIC=ON -DSTACK_TRACE=OFF -DBUILD_64=ON \
-DCMAKE_BUILD_TYPE=Release -DARCH="$MARCH" -DBUILD_TAG="$MTAG" -DUSE_DEVICE_TREZOR=OFF && \
make -j"$(nproc)" -C build/release daemon && \
mkdir -p /output && cp build/release/bin/mond /output/mond
# ---- Stage 3: 导出(保持 CI 期望的 linux_<arch>/mond 布局)----
FROM scratch
ARG TARGETARCH
COPY --from=build /output/mond /linux_${TARGETARCH}/mond