首次提交
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

This commit is contained in:
2025-12-02 11:57:14 +08:00
commit 612ec7b521
6 changed files with 451 additions and 0 deletions

33
docker/Dockerfile.Daemon Normal file
View File

@@ -0,0 +1,33 @@
FROM alpine:3.21
ARG TARGETARCH
ARG TARGZ_FILE_AMD64
ARG TARGZ_FILE_ARM64
RUN apk update && apk add --no-cache wget
COPY ./app /app
RUN if [ "$TARGETARCH" = "amd64" ]; then \
ARCH_FILE="$TARGZ_FILE_AMD64"; \
elif [ "$TARGETARCH" = "arm64" ]; then \
ARCH_FILE="$TARGZ_FILE_ARM64"; \
else \
echo "不支持的架构: $TARGETARCH" && exit 1; \
fi && \
echo "TARGETARCH: $TARGETARCH" && \
echo "使用文件: $ARCH_FILE" && \
ls -la /app/ && \
tar -xzf "/app/${ARCH_FILE}" -C /app --strip-components=1 && \
ls -la /app/ && \
rm -rf /app/*.tar.gz /app/config.json /app/config_cc.json /app/index.html /app/xxxigServer && \
addgroup -S xxxig && \
adduser -S -G xxxig xxxig && \
mkdir -p /app/data && \
chown -R xxxig:xxxig /app && \
chmod +x /app/xxxigDaemon /app/xxxigMiner
USER xxxig
WORKDIR /app
ENTRYPOINT ["/app/xxxigDaemon"]

78
docker/Dockerfile.Server Normal file
View File

@@ -0,0 +1,78 @@
FROM alpine:3.21
ARG TARGETARCH
ARG TARGZ_FILE_AMD64
ARG TARGZ_FILE_ARM64
RUN apk update && apk add --no-cache wget gettext
COPY ./app /app
RUN if [ "$TARGETARCH" = "amd64" ]; then \
ARCH_FILE="$TARGZ_FILE_AMD64"; \
elif [ "$TARGETARCH" = "arm64" ]; then \
ARCH_FILE="$TARGZ_FILE_ARM64"; \
else \
echo "不支持的架构: $TARGETARCH" && exit 1; \
fi && \
echo "TARGETARCH: $TARGETARCH" && \
echo "使用文件: $ARCH_FILE" && \
ls -la /app/ && \
tar -xzf "/app/${ARCH_FILE}" -C /app --strip-components=1 && \
ls -la /app/ && \
rm -rf /app/*.tar.gz /app/config.json /app/config_cc.json /app/xxxigDaemon /app/xxxigMiner && \
addgroup -S xxxig && \
adduser -S -G xxxig xxxig && \
mkdir -p /app/data && \
chown -R xxxig:xxxig /app && \
chmod +x /app/xxxigServer
ENV LOG_FILE=/app/data/xxxigServer.log \
BIND_IP=0.0.0.0 \
PORT=80 \
USER= \
PASS= \
ACCESS_TOKEN= \
TLS=false \
CERT_FILE= \
KEY_FILE= \
TG_BOT_TOKEN= \
TG_CHAT_ID=
COPY <<EOF /app/config.template.json
{
"bind-ip": "\${BIND_IP}",
"log-file": "\${LOG_FILE}",
"port": \${PORT},
"user": "\${USER}",
"pass": "\${PASS}",
"access-token": "\${ACCESS_TOKEN}",
"use-tls": \${TLS},
"cert-file": "\${CERT_FILE}",
"key-file": "\${KEY_FILE}",
"telegram-bot-token": "\${TG_BOT_TOKEN}",
"telegram-chat-id": "\${TG_CHAT_ID}"
}
EOF
RUN chmod 644 /app/config.template.json
COPY <<EOF /app/entrypoint.sh
#!/bin/sh
if [ ! -f /app/data/config.json ]; then
envsubst < /app/config.template.json > /app/data/config.json
fi
exec "\$@"
EOF
RUN chmod +x /app/entrypoint.sh
EXPOSE 80 443
VOLUME /app/data \
/app/certs
USER xxxig
WORKDIR /app
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["/app/xxxigServer", "-c", "/app/data/config.json"]

74
docker/Dockerfile.alpine Normal file
View File

@@ -0,0 +1,74 @@
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
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" ]; 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 -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

76
docker/Dockerfile.ubuntu Normal file
View File

@@ -0,0 +1,76 @@
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