4 Commits

Author SHA1 Message Date
9142021f26 添加deb包构建,删除容器构建
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 8s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 15s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 19s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 37s
Build and Release / release (push) Successful in 1m8s
2025-12-03 16:10:42 +08:00
8100b2f2e5 修改 PACKAGE_VERSION
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 7s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 7s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 14s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 22s
Build and Release / docker-images (push) Successful in 39s
Build and Release / release (push) Successful in 47s
2025-12-02 14:56:36 +08:00
877ba3d3bb 修改12
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 7s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 7s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 13s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 13s
Build and Release / docker-images (push) Successful in 26s
Build and Release / release (push) Successful in 53s
2025-12-02 14:51:55 +08:00
47c0c4de32 修改11
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 7s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 7s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 14s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 14s
Build and Release / docker-images (push) Successful in 25s
Build and Release / release (push) Successful in 27s
2025-12-02 14:41:55 +08:00
10 changed files with 426 additions and 212 deletions

View File

@@ -70,85 +70,28 @@ jobs:
test/xxxigDaemon --version 2>/dev/null || echo "⚠️ 跳过版本检查" test/xxxigDaemon --version 2>/dev/null || echo "⚠️ 跳过版本检查"
rm -rf test rm -rf test
- name: Build Debian package
if: matrix.distro == 'ubuntu'
run: |
# 安装 dpkg-deb如果需要
sudo apt-get update && sudo apt-get install -y dpkg-dev
TARGZ="${PRODUCT_NAME}-${{ matrix.arch }}-${{ matrix.distro }}-${PACKAGE_VERSION}.tar.gz"
echo "📦 Building Debian package for ${{ matrix.arch }}..."
chmod +x debian/build-deb.sh
./debian/build-deb.sh ${{ matrix.arch }} ${PACKAGE_VERSION} "${TARGZ}"
ls -lh *.deb
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4 - uses: https://github.com/ChristopherHX/gitea-upload-artifact@v4
with: with:
name: binaries-${{ matrix.arch }}-${{ matrix.distro }} name: binaries-${{ matrix.arch }}-${{ matrix.distro }}
path: "*.tar.gz" path: |
*.tar.gz
*.deb
retention-days: 1 retention-days: 1
docker-images:
runs-on: ubuntu-latest-amd64
needs: build-and-test
if: github.ref_name == 'main' || github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Debug branch info
run: |
echo "📋 Branch Information:"
echo " github.ref: ${{ github.ref }}"
echo " github.ref_name: ${{ github.ref_name }}"
echo " github.event_name: ${{ github.event_name }}"
- uses: https://github.com/ChristopherHX/gitea-download-artifact@v4
with:
pattern: binaries-*
path: ./app
merge-multiple: true
- name: Setup Docker and Login
run: |
# 尝试设置 QEMU忽略错误
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 2>/dev/null || true
# 创建 buildx builder增加资源限制和优化参数
docker buildx create --use --name multiarch-builder \
--driver docker-container \
--driver-opt network=host \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=50000000 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=10000000 \
--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host' \
|| true
docker buildx inspect --bootstrap
# 登录
echo "${{ secrets.BUILD_TOKEN }}" | docker login ${{ gitea.server_url }} -u ${{ gitea.actor }} --password-stdin
- name: Determine Docker tag
id: tag
run: |
if [ "${{ github.ref_name }}" = "main" ]; then
TAG="latest"
elif [ "${{ github.ref_name }}" = "develop" ]; then
TAG="develop"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG="${{ github.ref_name }}"
else
TAG="${{ github.ref_name }}"
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "📦 Docker tag: ${TAG}"
- name: Build and push Docker images
run: |
# 移除 URL 中的 https:// 前缀
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')/${{ gitea.repository }}
TAG="${{ steps.tag.outputs.tag }}"
echo "📦 Docker Registry: ${REGISTRY}"
echo "📦 Docker Tag: ${TAG}"
BUILD_ARGS="--pull --push --platform linux/amd64,linux/arm64 \
--build-arg TARGZ_FILE_AMD64=${PRODUCT_NAME}-amd64-alpine-${PACKAGE_VERSION}.tar.gz \
--build-arg TARGZ_FILE_ARM64=${PRODUCT_NAME}-arm64-alpine-${PACKAGE_VERSION}.tar.gz \
--provenance=false --sbom=false"
echo "🐳 Building server image..."
docker buildx build $BUILD_ARGS -t "${REGISTRY}/server:${TAG}" -f docker/Dockerfile.Server .
echo "🐳 Building daemon image..."
docker buildx build $BUILD_ARGS -t "${REGISTRY}/daemon:${TAG}" -f docker/Dockerfile.Daemon .
release: release:
runs-on: ubuntu-latest-amd64 runs-on: ubuntu-latest-amd64
needs: build-and-test needs: build-and-test
@@ -164,47 +107,115 @@ jobs:
env: env:
TOKEN: ${{ secrets.BUILD_TOKEN }} TOKEN: ${{ secrets.BUILD_TOKEN }}
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}
REGISTRY: ${{ gitea.server_url }}
OWNER: ${{ gitea.repository_owner }}
REPO: ${{ gitea.repository }}
run: | run: |
cd packages cd packages
# 上传所有包 # 提取仓库信息(移除 https:// 前缀和仓库路径)
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
OWNER="${{ gitea.repository_owner }}"
REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2)
echo "📦 上传包到 Generic Package Registry..." echo "📦 上传包到 Generic Package Registry..."
echo " Registry: ${REGISTRY}"
echo " Owner: ${OWNER}"
echo " Package: ${PRODUCT_NAME}"
echo " Version: ${TAG}"
# 上传所有 tar.gz 包到 Generic Package Registry
for file in *.tar.gz; do for file in *.tar.gz; do
[ ! -f "$file" ] && continue [ ! -f "$file" ] && continue
echo " ⬆️ $file" echo " ⬆️ $file"
curl -fsSL -X POST \ curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
-F "file=@$file" \ --upload-file "$file" \
"${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || { "https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || {
echo "❌ 上传失败: $file" echo "❌ 上传失败: $file"
exit 1 exit 1
} }
done done
# 生成 Release 描述 # 上传 Debian 包到 Debian Package Registry (支持多个发行版)
echo "📝 生成 Release 描述..." echo ""
BODY="## Release ${TAG}\n\n### 📥 下载链接\n" echo "📦 上传 Debian 包到 Debian Package Registry..."
for file in *.tar.gz; do for file in *.deb; do
[ -f "$file" ] && BODY="${BODY}- [${file}](${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/${file})\n" [ ! -f "$file" ] && continue
# 上传到 bookworm (Debian 12)
echo " ⬆️ $file → bookworm"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/bookworm/main/upload" || {
echo "❌ Debian 包上传失败: $file (bookworm)"
exit 1
}
# 上传到 trixie (Debian 13)
echo " ⬆️ $file → trixie"
curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \
--upload-file "$file" \
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/trixie/main/upload" || {
echo "❌ Debian 包上传失败: $file (trixie)"
exit 1
}
done done
# 生成 Release JSON payload
echo ""
echo "📝 生成 Release..."
export REGISTRY OWNER TAG
RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","### 📥 下载方式","","#### 方式 1: 直接下载(推荐)","","点击下面 **Assets** 部分的文件名直接下载。","","#### 方式 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### 方式 3: Debian Repository","","**Debian 12 (bookworm):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian bookworm main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install xxxigcc","```","","**Debian 13 (trixie):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian trixie main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install xxxigcc","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))')
# 创建 Release # 创建 Release
echo ""
echo "🎉 创建 Release..." echo "🎉 创建 Release..."
curl -fsSL -X POST \ RESPONSE=$(curl -fsSL -w "\n%{http_code}" -X POST \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
"${REGISTRY}/api/v1/repos/${REPO}/releases" \ "https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
-d @- << EOF || echo "⚠️ Release 可能已存在" -d "${RELEASE_DATA}")
{
"tag_name": "${TAG}",
"name": "Release ${TAG}",
"body": "${BODY}",
"draft": false,
"prerelease": false
}
EOF
echo "✅ Release 创建完成!" HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" = "201" ]; then
echo "✅ Release 创建成功"
RELEASE_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
elif [ "$HTTP_CODE" = "409" ]; then
echo "⚠️ Release 已存在,获取现有 Release ID..."
RELEASE_ID=$(curl -fsSL \
-H "Authorization: token ${TOKEN}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/tags/${TAG}" | \
grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2)
echo " Release ID: ${RELEASE_ID}"
else
echo "❌ 创建 Release 失败 (HTTP ${HTTP_CODE})"
echo "$RESPONSE_BODY"
exit 1
fi
# 上传文件作为 Release 附件
echo ""
echo "📎 上传文件作为 Release 附件..."
for file in *.tar.gz *.deb; do
[ ! -f "$file" ] && continue
echo " ⬆️ $file"
# 使用 multipart/form-data 上传附件
curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \
-F "attachment=@${file}" \
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${file}" || {
echo " ⚠️ 附件上传失败: $file可能已存在"
}
done
echo ""
echo "✅ Release 创建完成!"
echo "🔗 访问: https://${REGISTRY}/${{ gitea.repository }}/releases/tag/${TAG}"
# 清理临时文件
rm -f release_body.md

91
debian/build-deb.sh vendored Executable file
View File

@@ -0,0 +1,91 @@
#!/bin/bash
set -e
# 参数检查
if [ $# -ne 3 ]; then
echo "Usage: $0 <ARCH> <VERSION> <TARGZ_FILE>"
echo "Example: $0 amd64 3.4.6-xg1 xxxigcc-amd64-ubuntu-3.4.6-xg1.tar.gz"
exit 1
fi
ARCH=$1
VERSION=$2
TARGZ_FILE=$3
PKG_NAME="xxxigcc"
DEB_FILE="${PKG_NAME}_${VERSION}_${ARCH}.deb"
# 转换架构名称Docker 使用的架构名到 Debian 架构名)
case "$ARCH" in
amd64)
DEB_ARCH="amd64"
;;
arm64)
DEB_ARCH="arm64"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
echo "📦 Building Debian package: ${DEB_FILE}"
echo " Architecture: ${DEB_ARCH}"
echo " Version: ${VERSION}"
echo " Source: ${TARGZ_FILE}"
# 创建临时目录
BUILD_DIR=$(mktemp -d)
trap "rm -rf $BUILD_DIR" EXIT
# 创建包目录结构
PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${VERSION}_${DEB_ARCH}"
mkdir -p "${PKG_DIR}/DEBIAN"
mkdir -p "${PKG_DIR}/opt/xxxigcc"
mkdir -p "${PKG_DIR}/lib/systemd/system"
# 解压二进制文件
echo "📂 Extracting binaries..."
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/opt/xxxigcc"
# 生成 control 文件
echo "📝 Generating control file..."
sed -e "s/{{VERSION}}/${VERSION}/" \
-e "s/{{ARCH}}/${DEB_ARCH}/" \
debian/control.template > "${PKG_DIR}/DEBIAN/control"
# 复制维护脚本
echo "📋 Copying maintainer scripts..."
cp debian/postinst "${PKG_DIR}/DEBIAN/postinst"
cp debian/prerm "${PKG_DIR}/DEBIAN/prerm"
cp debian/postrm "${PKG_DIR}/DEBIAN/postrm"
chmod 755 "${PKG_DIR}/DEBIAN/postinst"
chmod 755 "${PKG_DIR}/DEBIAN/prerm"
chmod 755 "${PKG_DIR}/DEBIAN/postrm"
# 复制 systemd service 文件
echo "🔧 Installing systemd services..."
cp debian/xxxigcc-server.service "${PKG_DIR}/lib/systemd/system/"
cp debian/xxxigcc-daemon.service "${PKG_DIR}/lib/systemd/system/"
# 设置权限
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigServer"
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigDaemon"
chmod 755 "${PKG_DIR}/opt/xxxigcc/xxxigMiner"
chmod 644 "${PKG_DIR}/opt/xxxigcc/config.json"
chmod 644 "${PKG_DIR}/opt/xxxigcc/config_cc.json"
chmod 644 "${PKG_DIR}/opt/xxxigcc/index.html"
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxigcc-server.service"
chmod 644 "${PKG_DIR}/lib/systemd/system/xxxigcc-daemon.service"
# 构建 deb 包
echo "🔨 Building package..."
dpkg-deb --build --root-owner-group "${PKG_DIR}" "${DEB_FILE}"
# 检查包
echo "✅ Package built successfully!"
echo "📦 Package: $(pwd)/${DEB_FILE}"
echo "📊 Package info:"
dpkg-deb --info "${DEB_FILE}"
echo ""
echo "🎉 Done!"

18
debian/control.template vendored Normal file
View File

@@ -0,0 +1,18 @@
Package: xxxigcc
Version: {{VERSION}}
Section: net
Priority: optional
Architecture: {{ARCH}}
Depends: libc6, libuv1, libssl3 | libssl1.1, libhwloc15 | libhwloc5
Maintainer: XXXigCC Team <noreply@example.com>
Homepage: https://github.com/Bendr0id/xmrigCC
Description: Cryptocurrency mining software suite
XXXigCC is a customized build of XMRigCC,
a cryptocurrency mining software with centralized management.
.
This package includes:
- xxxigServer: Central control server with web UI
- xxxigDaemon: Client daemon that connects to the server
- xxxigMiner: Mining executable controlled by the daemon
- Systemd service configurations
- Default configuration files

82
debian/postinst vendored Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/sh
set -e
# Create user and group if they don't exist
if ! getent group xxxigcc >/dev/null; then
addgroup --system xxxigcc
fi
if ! getent passwd xxxigcc >/dev/null; then
adduser --system --ingroup xxxigcc --no-create-home \
--home /opt/xxxigcc --shell /usr/sbin/nologin \
--gecos "XXXigCC Service" xxxigcc
fi
# Create log directory
mkdir -p /var/log/xxxigcc
chown xxxigcc:xxxigcc /var/log/xxxigcc
chmod 750 /var/log/xxxigcc
# Create config directory
mkdir -p /etc/xxxigcc
# Copy default configs if they don't exist
if [ ! -f /etc/xxxigcc/config.json ]; then
cp /opt/xxxigcc/config.json /etc/xxxigcc/config.json
chown xxxigcc:xxxigcc /etc/xxxigcc/config.json
chmod 640 /etc/xxxigcc/config.json
fi
if [ ! -f /etc/xxxigcc/config_cc.json ]; then
cp /opt/xxxigcc/config_cc.json /etc/xxxigcc/config_cc.json
chown xxxigcc:xxxigcc /etc/xxxigcc/config_cc.json
chmod 640 /etc/xxxigcc/config_cc.json
fi
# Set permissions
chown -R xxxigcc:xxxigcc /opt/xxxigcc
chmod 755 /opt/xxxigcc
chmod 755 /opt/xxxigcc/xxxigServer
chmod 755 /opt/xxxigcc/xxxigDaemon
chmod 755 /opt/xxxigcc/xxxigMiner
# Reload systemd
if [ -d /run/systemd/system ]; then
systemctl daemon-reload
# Note: Services are NOT auto-enabled or auto-started
# Users should manually enable the services they need:
# systemctl enable xxxigcc-server.service
# systemctl start xxxigcc-server.service
# or
# systemctl enable xxxigcc-daemon.service
# systemctl start xxxigcc-daemon.service
fi
echo ""
echo "✅ XXXigCC installed successfully!"
echo ""
echo "📋 Service Information:"
echo ""
echo " xxxigcc-server - Control server with web UI (uses config_cc.json)"
echo " xxxigcc-daemon - Mining client daemon (uses config.json, auto-calls xxxigMiner)"
echo ""
echo "To start the server (central control):"
echo " sudo systemctl enable xxxigcc-server.service"
echo " sudo systemctl start xxxigcc-server.service"
echo ""
echo "To start the daemon (mining client):"
echo " sudo systemctl enable xxxigcc-daemon.service"
echo " sudo systemctl start xxxigcc-daemon.service"
echo ""
echo "Configuration files:"
echo " /etc/xxxigcc/config.json - Daemon/Miner configuration"
echo " /etc/xxxigcc/config_cc.json - Server configuration"
echo ""
echo "Binaries location:"
echo " /opt/xxxigcc/xxxigServer - Control server"
echo " /opt/xxxigcc/xxxigDaemon - Client daemon (auto-calls xxxigMiner)"
echo " /opt/xxxigcc/xxxigMiner - Miner executable"
echo ""
exit 0

30
debian/postrm vendored Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
set -e
case "$1" in
purge)
# Remove log directory
rm -rf /var/log/xxxigcc
# Remove config directory
rm -rf /etc/xxxigcc
# Remove user and group
if getent passwd xxxigcc >/dev/null; then
deluser --system xxxigcc 2>/dev/null || true
fi
if getent group xxxigcc >/dev/null; then
delgroup --system xxxigcc 2>/dev/null || true
fi
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
# Reload systemd
if [ -d /run/systemd/system ]; then
systemctl daemon-reload
fi
;;
esac
exit 0

17
debian/prerm vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -e
# Stop services before removal
if [ -d /run/systemd/system ]; then
for service in xxxigcc-server.service xxxigcc-daemon.service; do
if systemctl is-active "$service" >/dev/null 2>&1; then
systemctl stop "$service"
fi
if systemctl is-enabled "$service" >/dev/null 2>&1; then
systemctl disable "$service"
fi
done
fi
exit 0

38
debian/xxxigcc-daemon.service vendored Normal file
View File

@@ -0,0 +1,38 @@
[Unit]
Description=XXXigCC Daemon (Miner Client)
After=network.target
[Service]
Type=simple
# 工作目录
WorkingDirectory=/opt/xxxigcc
# 执行命令
ExecStart=/opt/xxxigcc/xxxigDaemon --config /etc/xxxigcc/config.json --log-file=/var/log/xxxigcc/daemon.log
# 重启策略
Restart=always
RestartSec=10
# 用户和组
User=xxxigcc
Group=xxxigcc
# 安全设置
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/xxxigcc
# 日志设置
StandardOutput=journal
StandardError=journal
SyslogIdentifier=xxxigcc-daemon
# 资源限制
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

38
debian/xxxigcc-server.service vendored Normal file
View File

@@ -0,0 +1,38 @@
[Unit]
Description=XXXigCC Server (Control Center)
After=network.target
[Service]
Type=simple
# 工作目录
WorkingDirectory=/opt/xxxigcc
# 执行命令
ExecStart=/opt/xxxigcc/xxxigServer --config /etc/xxxigcc/config_cc.json --log-file=/var/log/xxxigcc/server.log
# 重启策略
Restart=always
RestartSec=10
# 用户和组
User=xxxigcc
Group=xxxigcc
# 安全设置
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/log/xxxigcc
# 日志设置
StandardOutput=journal
StandardError=journal
SyslogIdentifier=xxxigcc-server
# 资源限制
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target

View File

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

View File

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