Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

ARMv8 Docker OpenWrt #96

ARMv8 Docker OpenWrt

ARMv8 Docker OpenWrt #96

name: ARMv8 Docker OpenWrt
on:
workflow_dispatch:
schedule:
- cron: 0 23 * * 5
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
CONFIG_FILE: configs/armv8-docker.config
DIY_SCRIPT: diy-script.sh
CLASH_KERNEL: arm64
DOCKER_BUILD: buildImageX.sh
DOCKER_IMAGE: summary/openwrt-aarch64
TZ: Asia/Shanghai
jobs:
Build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@main
- name: Check Server Performance
run: |
echo "警告⚠"
echo "分配的服务器性能有限,若选择的插件过多,务必注意CPU性能!"
echo -e "已知CPU型号(降序): 7763,8370C,8272CL,8171M,E5-2673\n"
echo "--------------------------CPU信息--------------------------"
echo "CPU物理数量: $(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
echo "CPU核心数量: $(nproc)"
echo -e "CPU型号信息:$(cat /proc/cpuinfo | grep -m1 name | awk -F: '{print $2}')\n"
echo "--------------------------内存信息--------------------------"
echo "已安装内存详细信息:"
echo -e "$(sudo lshw -short -C memory | grep GiB)\n"
echo "--------------------------硬盘信息--------------------------"
echo "硬盘数量: $(ls /dev/sd* | grep -v [1-9] | wc -l)" && df -hT
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi $(docker images -q)
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android $AGENT_TOOLSDIRECTORY
sudo -E apt-get -y update
sudo -E apt-get -y install $(curl -fsSL is.gd/depends_ubuntu_2204)
sudo -E apt-get -y autoremove --purge
sudo -E apt-get -y clean
sudo timedatectl set-timezone "$TZ"
- name: Clone Source Code
run: |
df -hT $GITHUB_WORKSPACE
git clone $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
echo "OPENWRT_PATH=$PWD" >> $GITHUB_ENV
version=$(cat "package/lean/default-settings/files/zzz-default-settings" | grep DISTRIB_REVISION= | awk -F "'" '{print $2}')
echo "TAG=$version" >> $GITHUB_ENV
- name: Install Feeds
run: |
cd $OPENWRT_PATH
./scripts/feeds update -a
./scripts/feeds install -a
- name: Load Custom Configuration
run: |
[ -e files ] && mv files $OPENWRT_PATH/files
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE $OPENWRT_PATH/.config
sed -i '/\/clash_/d; /.dat/d' scripts/preset-clash-core.sh
chmod +x $GITHUB_WORKSPACE/scripts/*.sh
chmod +x $DIY_SCRIPT
cd $OPENWRT_PATH
$GITHUB_WORKSPACE/$DIY_SCRIPT
$GITHUB_WORKSPACE/scripts/preset-clash-core.sh $CLASH_KERNEL
- name: Download DL Package
run: |
cd $OPENWRT_PATH
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile Firmware
id: compile
run: |
cd $OPENWRT_PATH
mkdir -p files/etc/uci-defaults
cp $GITHUB_WORKSPACE/scripts/init-settings.sh files/etc/uci-defaults/99-init-settings
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
- name: Generate Firmware
if: steps.compile.outputs.status == 'success'
id: generate
run: |
cd $OPENWRT_PATH/bin/targets/*/*
cat config.buildinfo
cp *rootfs.tar.gz $GITHUB_WORKSPACE/docker
cd $GITHUB_WORKSPACE/docker
chmod +x $DOCKER_BUILD && ./$DOCKER_BUILD
echo "status=success" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: Login to Docker Hub
uses: docker/login-action@master
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker
if: steps.generate.outputs.status == 'success'
uses: docker/build-push-action@master
with:
context: docker
platforms: linux/arm64
push: true
tags: |
${{ env.DOCKER_IMAGE }}:${{ env.TAG }}
${{ env.DOCKER_IMAGE }}