Files
xxxigcc/docker/Dockerfile.alpine
Wang Defa 28a67a26b1
Some checks failed
Build and Release / build-and-test (alpine) (push) Failing after 5m57s
Build and Release / build-and-test (ubuntu) (push) Failing after 6m15s
Build and Release / docker-images (push) Has been skipped
Build and Release / release (push) Has been skipped
修改3
2025-12-02 13:04:38 +08:00

84 lines
2.3 KiB
Docker

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 XMRIGCC_VERSION
ARG TARGETARCH
ARG BUILDPLATFORM
ARG TARGETPLATFORM
RUN git clone --recursive https://github.com/Bendr0id/xmrigCC.git && \
mv xmrigCC xxxigcc && \
cd xxxigcc && \
git checkout ${XMRIGCC_VERSION}
WORKDIR /xxxigcc
COPY ./init.sh ./init.sh
# 根据目标架构优化编译
RUN chmod +x ./init.sh && ./init.sh && \
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 .. -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 .. -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 .. -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 /xxxigcc/build/xxxigDaemon /linux_${TARGETARCH}/xxxigDaemon
COPY --from=build /xxxigcc/build/xxxigMiner /linux_${TARGETARCH}/xxxigMiner
COPY --from=build /xxxigcc/build/xxxigServer /linux_${TARGETARCH}/xxxigServer
COPY --from=build /xxxigcc/src/config_cc.json /linux_${TARGETARCH}/config_cc.json
COPY --from=build /xxxigcc/src/config.json /linux_${TARGETARCH}/config.json
COPY --from=build /xxxigcc/index.html /linux_${TARGETARCH}/index.html