Files
xxxigcc/docker/Dockerfile.ubuntu
Wang Defa 612ec7b521
Some checks failed
Build and Release / build-and-test (alpine) (push) Failing after 53s
Build and Release / build-and-test (ubuntu) (push) Failing after 8m7s
Build and Release / docker-images (push) Has been skipped
Build and Release / release (push) Has been skipped
首次提交
2025-12-02 11:57:14 +08:00

77 lines
2.6 KiB
Docker

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 XMRIGCC_VERSION
ARG TARGETARCH
ARG BUILDPLATFORM
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 && ./build_deps.sh && cd ../build && \
if [ "$TARGETARCH" = "arm64" ] && [ "$BUILDPLATFORM" != "linux/arm64" ]; then \
export CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++; \
cmake .. -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 .. -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 .. -DCMAKE_BUILD_TYPE=Release \
-DXMRIG_DEPS=scripts/deps \
-DWITH_ZLIB=ON; \
fi && \
make -j$(nproc)
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