Docker 改静态链接 OpenSSL,修复跨发行版运行
Build and Release / build-and-test (arm64, alpine) (push) Successful in 6s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 12s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 22s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 22s
Build and Release / release (push) Successful in 19s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Wang Defa
2026-06-09 16:59:25 +08:00
co-authored by Claude Opus 4.8
parent 116023cd24
commit a362c1a859
4 changed files with 19 additions and 17 deletions
+7 -6
View File
@@ -5,18 +5,18 @@ ARG TARGETARCH
RUN apk update && apk add --no-cache \
git \
wget \
make \
cmake \
libstdc++ \
gcc \
g++ \
musl-dev \
automake \
libtool \
autoconf \
linux-headers \
libuv-dev \
openssl-dev \
hwloc-dev
perl
FROM base AS build
@@ -31,15 +31,16 @@ RUN git clone --recursive https://github.com/wangdefaa/xxxig-proxy.git && \
WORKDIR /xxxig-proxy
# 根据目标架构优化编译
RUN mkdir build && cd build && \
# 先编译静态依赖(libuv/OpenSSL)到 scripts/deps,再静态链接构建 proxy
RUN mkdir build && cd scripts && chmod +x ./*.sh && \
if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS (cross-compile: $([ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] && echo yes || echo no))" && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
./build_deps.sh $MAKE_JOBS && cd ../build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON && \
make $MAKE_JOBS
FROM scratch
+8 -7
View File
@@ -11,10 +11,10 @@ RUN apt-get update && apt-get install -y \
wget \
build-essential \
cmake \
libuv1-dev \
libssl-dev \
libhwloc-dev \
openssl \
automake \
autoconf \
libtool \
perl \
&& rm -rf /var/lib/apt/lists/*
FROM base AS build
@@ -30,15 +30,16 @@ RUN git clone --recursive https://github.com/wangdefaa/xxxig-proxy.git && \
WORKDIR /xxxig-proxy
# 根据目标架构优化编译
RUN mkdir build && cd build && \
# 先编译静态依赖(libuv/OpenSSL)到 scripts/deps,再静态链接构建 proxy
RUN mkdir build && cd scripts && chmod +x ./*.sh && \
if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]; then \
MAKE_JOBS="-j2"; \
else \
MAKE_JOBS="-j$(nproc)"; \
fi && \
echo "Building with parallel jobs: $MAKE_JOBS (cross-compile: $([ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] && echo yes || echo no))" && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
./build_deps.sh $MAKE_JOBS && cd ../build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DXMRIG_DEPS=scripts/deps -DBUILD_STATIC=ON && \
make $MAKE_JOBS
FROM scratch