♻️ 重构代码和docker-runner项目结构
Ubuntu System Information / show-system-info (push) Failing after 38s

 支持`docker`部署`archlinux`,预装`clang`跨平台编译工具链
This commit is contained in:
csh
2025-12-09 16:06:25 +08:00
parent 4829434408
commit 39820e656a
18 changed files with 639 additions and 2466 deletions
@@ -0,0 +1,68 @@
FROM archlinux:latest
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# 初始化密钥和软件源
RUN pacman-key --init && \
pacman-key --populate archlinux && \
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf && \
printf "\n[archlinuxcn]\nServer = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch\n" >> /etc/pacman.conf && \
pacman -Syy --noconfirm
# 安装基础工具、Buildx 支持和开发环境
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm --disable-download-timeout archlinuxcn-keyring && \
pacman -S --noconfirm --needed \
base-devel \
ca-certificates \
clang \
lld \
libc++ \
libc++abi \
cmake \
ninja \
curl \
git \
python \
python-pyyaml \
python-pip \
paru \
conan \
sudo \
vim \
supervisor \
qemu-user-static \
qemu-user-static-binfmt \
docker \
docker-buildx \
&& pacman -Scc --noconfirm
# AUR 用户(paru 需非 root 运行)
RUN useradd -m aur && \
echo "aur ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aur && \
chmod 0440 /etc/sudoers.d/aur
# 安装额外的 AUR 工具
USER aur
WORKDIR /home/aur
RUN paru -S --noconfirm --needed --noprogressbar llvm-mingw-w64-toolchain-ucrt-bin && \
paru -Scc --noconfirm && \
rm -rf ~/.cache/paru
# 切换回 root
USER root
WORKDIR /root
# 验证 qemu 和 docker 安装
RUN qemu-aarch64-static --version && \
qemu-x86_64-static --version && \
docker --version
# 创建必要目录
RUN mkdir -p /data /etc/supervisor/conf.d /var/log/supervisor
# 设置工作目录
WORKDIR /data
# 使用自定义入口点
ENTRYPOINT ["/data/entrypoint.sh"]
@@ -0,0 +1,35 @@
services:
gitea-runner:
build: .
container_name: gitea-runner-buildx-archlinux
restart: unless-stopped
network_mode: "host" # 使用宿主机网络
privileged: true # Buildx 需要 privileged 模式
volumes:
- ./runner-data:/data
- ../../common/setup.sh:/data/setup.sh:ro
- ../../common/register.sh:/data/register.sh:ro
- ../../common/manage.sh:/data/manage.sh:ro
- ../../common/check_crlf.sh:/data/check_crlf.sh:ro
- ../../common/entrypoint.sh:/data/entrypoint.sh:ro
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=Asia/Shanghai
# Arch Linux Buildx 配置 - 使用 tonistiigi/binfmt
- ENABLE_BUILDX=true
- BINFMT_METHOD=tonistiigi
- DEFAULT_RUNNER_LABEL=archlinux:host://archlinux:latest,company-server:host://archlinux:latest,buildx-archlinux:host://archlinux:latest
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
# - http_proxy=http://host.docker.internal:20122
# - https_proxy=http://host.docker.internal:20122
# - HTTP_PROXY=http://host.docker.internal:20122
# - HTTPS_PROXY=http://host.docker.internal:20122
# - no_proxy=localhost,127.0.0.1
# Linux 系统需要取消下面的注释以支持 host.docker.internal
# extra_hosts:
# - "host.docker.internal:host-gateway"
@@ -0,0 +1,37 @@
FROM ubuntu:22.04
# 设置环境变量避免交互式安装
ENV DEBIAN_FRONTEND=noninteractive
# 更新系统并安装必要软件
RUN apt-get update && apt-get install -y \
curl \
git \
python3 \
python3-yaml \
supervisor \
ca-certificates \
gnupg \
lsb-release \
qemu-user-static \
binfmt-support \
&& rm -rf /var/lib/apt/lists/*
# 安装 Docker(包含 Buildx 插件)
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sh get-docker.sh && \
rm get-docker.sh
# 验证安装
RUN docker --version && \
qemu-aarch64-static --version && \
qemu-x86_64-static --version
# 创建必要目录
RUN mkdir -p /data /etc/supervisor/conf.d /var/log/supervisor
# 设置工作目录
WORKDIR /data
# 使用自定义入口点
ENTRYPOINT ["/data/entrypoint.sh"]
@@ -0,0 +1,35 @@
services:
gitea-runner:
build: .
container_name: gitea-runner-buildx-ubuntu-22
restart: unless-stopped
network_mode: "host" # 使用宿主机网络
privileged: true # Buildx 需要 privileged 模式
volumes:
- ./runner-data:/data
- ../../common/setup.sh:/data/setup.sh:ro
- ../../common/register.sh:/data/register.sh:ro
- ../../common/manage.sh:/data/manage.sh:ro
- ../../common/check_crlf.sh:/data/check_crlf.sh:ro
- ../../common/entrypoint.sh:/data/entrypoint.sh:ro
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=Asia/Shanghai
# Buildx 配置 - 启用多架构构建
- ENABLE_BUILDX=true
- BINFMT_METHOD=update-binfmts
- DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,buildx-ubuntu-22:host://ubuntu:22.04
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
# - http_proxy=http://host.docker.internal:20122
# - https_proxy=http://host.docker.internal:20122
# - HTTP_PROXY=http://host.docker.internal:20122
# - HTTPS_PROXY=http://host.docker.internal:20122
# - no_proxy=localhost,127.0.0.1
# Linux 系统需要取消下面的注释以支持 host.docker.internal
# extra_hosts:
# - "host.docker.internal:host-gateway"
@@ -0,0 +1,32 @@
FROM ubuntu:22.04
# 设置环境变量避免交互式安装
ENV DEBIAN_FRONTEND=noninteractive
# RUN apt-get update && \
# apt-get install -y ca-certificates && \
# update-ca-certificates && \
# rm -rf /var/lib/apt/lists/*
# RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list && \
# sed -i 's@//.*security.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list
# 更新系统并安装必要软件
RUN apt-get update && apt-get install -y \
curl \
git \
jq \
python3 \
python3-yaml \
supervisor \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# 创建必要目录
RUN mkdir -p /data /etc/supervisor/conf.d /var/log/supervisor
# 设置工作目录
WORKDIR /data
# 使用自定义入口点
ENTRYPOINT ["/data/entrypoint.sh"]
@@ -0,0 +1,32 @@
services:
gitea-runner:
build: .
container_name: gitea-runner-standard-ubuntu-22
restart: unless-stopped
network_mode: "host" # 使用宿主机网络
volumes:
- ./runner-data:/data
- ../../common/setup.sh:/data/setup.sh:ro
- ../../common/register.sh:/data/register.sh:ro
- ../../common/manage.sh:/data/manage.sh:ro
- ../../common/entrypoint.sh:/data/entrypoint.sh:ro
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=Asia/Shanghai
# Standard 配置 - 不启用 Buildx
- ENABLE_BUILDX=false
- DEFAULT_RUNNER_LABEL=ubuntu-22.04:host://ubuntu:22.04,company-server:host://ubuntu:22.04,standard-ubuntu-22:host://ubuntu:22.04
# 如果需要使用代理,取消下面的注释并修改为你的代理地址
# 注意:容器内访问宿主机需要使用 host.docker.internal 或宿主机IP
# - http_proxy=http://host.docker.internal:20122
# - https_proxy=http://host.docker.internal:20122
# - HTTP_PROXY=http://host.docker.internal:20122
# - HTTPS_PROXY=http://host.docker.internal:20122
# - no_proxy=localhost,127.0.0.1
# Linux 系统需要取消下面的注释以支持 host.docker.internal
# extra_hosts:
# - "host.docker.internal:host-gateway"