初始化 XXXig 打包部署脚本与 CI 流水线
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 1m12s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 1m21s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 5m24s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 6m8s
Build and Release / release (push) Has been skipped
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 1m12s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 1m21s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 5m24s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 6m8s
Build and Release / release (push) Has been skipped
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
FROM alpine:latest AS base
|
||||
|
||||
# 根据目标架构设置构建参数
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
git \
|
||||
make \
|
||||
cmake \
|
||||
libstdc++ \
|
||||
gcc \
|
||||
g++ \
|
||||
automake \
|
||||
libtool \
|
||||
autoconf \
|
||||
linux-headers \
|
||||
libuv-dev \
|
||||
openssl-dev \
|
||||
hwloc-dev
|
||||
|
||||
FROM base AS build
|
||||
|
||||
ARG TARGZ_FILE
|
||||
ARG XXXIG_VERSION
|
||||
ARG TARGETARCH
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN git clone --recursive https://github.com/wangdefaa/xxxig.git && \
|
||||
cd xxxig && \
|
||||
git checkout ${XXXIG_VERSION}
|
||||
|
||||
WORKDIR /xxxig
|
||||
|
||||
|
||||
# 根据目标架构优化编译
|
||||
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))" && \
|
||||
./build_deps.sh $MAKE_JOBS && cd ../build && \
|
||||
if [ "$TARGETARCH" = "arm64" ]; then \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DBUILD_STATIC=ON \
|
||||
-DWITH_ZLIB=ON \
|
||||
-DWITH_OPENCL=OFF \
|
||||
-DWITH_CUDA=OFF \
|
||||
-DARM_TARGET=8; \
|
||||
elif [ "$TARGETARCH" = "arm" ]; then \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DBUILD_STATIC=ON \
|
||||
-DWITH_ZLIB=ON \
|
||||
-DWITH_OPENCL=OFF \
|
||||
-DWITH_CUDA=OFF \
|
||||
-DARM_TARGET=7; \
|
||||
else \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DBUILD_STATIC=ON \
|
||||
-DWITH_ZLIB=ON \
|
||||
-DWITH_OPENCL=OFF \
|
||||
-DWITH_CUDA=OFF; \
|
||||
fi && \
|
||||
make $MAKE_JOBS
|
||||
|
||||
FROM scratch
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
COPY --from=build /xxxig/build/xxxigDaemon /linux_${TARGETARCH}/xxxigDaemon
|
||||
COPY --from=build /xxxig/build/xxxig /linux_${TARGETARCH}/xxxig
|
||||
COPY --from=build /xxxig/build/xxxigServer /linux_${TARGETARCH}/xxxigServer
|
||||
COPY --from=build /xxxig/src/config_cc.json /linux_${TARGETARCH}/config_cc.json
|
||||
COPY --from=build /xxxig/src/config.json /linux_${TARGETARCH}/config.json
|
||||
COPY --from=build /xxxig/index.html /linux_${TARGETARCH}/index.html
|
||||
@@ -0,0 +1,86 @@
|
||||
FROM ubuntu:20.04 AS base
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG BUILDPLATFORM
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 根据目标架构安装相应的交叉编译工具链
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
wget \
|
||||
build-essential \
|
||||
cmake \
|
||||
libuv1-dev \
|
||||
libssl-dev \
|
||||
libhwloc-dev \
|
||||
&& if [ "$TARGETARCH" = "arm64" ] && [ "$BUILDPLATFORM" != "linux/arm64" ]; then \
|
||||
apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu; \
|
||||
elif [ "$TARGETARCH" = "arm" ] && [ "$BUILDPLATFORM" != "linux/arm/v7" ]; then \
|
||||
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf; \
|
||||
fi \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
FROM base AS build
|
||||
|
||||
ARG TARGZ_FILE
|
||||
ARG TARGET_ARCH
|
||||
ARG XXXIG_VERSION
|
||||
ARG TARGETARCH
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN git clone --recursive https://github.com/wangdefaa/xxxig.git && \
|
||||
cd xxxig && \
|
||||
git checkout ${XXXIG_VERSION}
|
||||
|
||||
WORKDIR /xxxig
|
||||
|
||||
# 根据目标架构设置编译环境和参数
|
||||
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))" && \
|
||||
./build_deps.sh $MAKE_JOBS && cd ../build && \
|
||||
if [ "$TARGETARCH" = "arm64" ] && [ "$BUILDPLATFORM" != "linux/arm64" ]; then \
|
||||
export CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++; \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
|
||||
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
|
||||
-DARM_TARGET=8 \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DWITH_ZLIB=ON; \
|
||||
elif [ "$TARGETARCH" = "arm" ] && [ "$BUILDPLATFORM" != "linux/arm/v7" ]; then \
|
||||
export CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++; \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
|
||||
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
|
||||
-DARM_TARGET=7 \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DWITH_ZLIB=ON; \
|
||||
else \
|
||||
cmake .. -DWITH_CC_CLIENT=ON \
|
||||
-DWITH_CC_SERVER=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DXMRIG_DEPS=scripts/deps \
|
||||
-DWITH_ZLIB=ON; \
|
||||
fi && \
|
||||
make $MAKE_JOBS
|
||||
|
||||
FROM scratch
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
COPY --from=build /xxxig/build/xxxigDaemon /linux_${TARGETARCH}/xxxigDaemon
|
||||
COPY --from=build /xxxig/build/xxxig /linux_${TARGETARCH}/xxxig
|
||||
COPY --from=build /xxxig/build/xxxigServer /linux_${TARGETARCH}/xxxigServer
|
||||
COPY --from=build /xxxig/src/config_cc.json /linux_${TARGETARCH}/config_cc.json
|
||||
COPY --from=build /xxxig/src/config.json /linux_${TARGETARCH}/config.json
|
||||
COPY --from=build /xxxig/index.html /linux_${TARGETARCH}/index.html
|
||||
Reference in New Issue
Block a user