From 4083e543ba8acd6ff833f39a2a2b91d86122b147 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 11:24:42 +0800 Subject: [PATCH 1/7] [wip] test pipeline --- .github/workflows/release.yaml | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..db6de27 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,72 @@ +name: Build and Release + +on: + push: + # branches: + # - 'main' + # tags: + # - '*' + pull_request: + branches: + - 'main' + +jobs: + build-rootfs: + runs-on: ubuntu-latest + container: + image: ghcr.io/tiny-webui/image-builder:latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build RootFS + run: make image -j$(nproc) + + - name: Upload RootFS artifact + uses: actions/upload-artifact@v4 + with: + name: rootfs + path: output/ + + publish-container: + needs: build-rootfs + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download RootFS artifact + uses: actions/download-artifact@v4 + with: + name: rootfs + path: output + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/tiny-webui/tiny-webui + tags: | + type=ref,event=tag + type=raw,value=latest + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 93537bf0c5a89e5aceccaad6418f727774da9a3d Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 11:26:23 +0800 Subject: [PATCH 2/7] [wip] include submodules --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index db6de27..c8f10fe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,6 +18,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + submodules: true - name: Build RootFS run: make image -j$(nproc) From 80ae91f53514dbdb5485457886c66c4f0e4280c3 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 11:32:56 +0800 Subject: [PATCH 3/7] resume settings --- .github/workflows/release.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c8f10fe..68143ef 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,10 +2,10 @@ name: Build and Release on: push: - # branches: - # - 'main' - # tags: - # - '*' + branches: + - 'main' + tags: + - '*' pull_request: branches: - 'main' From fedf1cc3f0b950df72683fc7bd535cc4bcb3f25b Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 12:49:49 +0800 Subject: [PATCH 4/7] add arm64 config --- Makefile | 13 ++++---- external/configs/tiny-webui-arm64_defconfig | 33 +++++++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 external/configs/tiny-webui-arm64_defconfig diff --git a/Makefile b/Makefile index 11f7e28..dfad3e3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ EXTERNAL_PATH=external -EXTERNAL_CONFIG_NAME=tiny-webui-x64_defconfig +TARGET_PLATFORM?=x64 +EXTERNAL_CONFIG_NAME=tiny-webui-$(TARGET_PLATFORM)_defconfig +OUTPUT_DIR=output +IMAGE_OUTPUT_DIR=$(OUTPUT_DIR)/$(TARGET_PLATFORM) all:docker-image @@ -21,15 +24,15 @@ image:config mkdir -p dl_cache cp -r dl_cache buildroot/dl $(MAKE) -C buildroot - rm -rf output - mkdir -p output - cp buildroot/output/images/rootfs.tar output + rm -rf $(IMAGE_OUTPUT_DIR) + mkdir -p $(IMAGE_OUTPUT_DIR) + cp buildroot/output/images/rootfs.tar $(IMAGE_OUTPUT_DIR)/ .PHONY:docker-image docker-image:image - docker rmi tiny-webui:latest docker build -f docker/Dockerfile -t tiny-webui:latest . - docker save tiny-webui:latest -o output/tiny-webui.tar + docker save tiny-webui:latest -o $(OUTPUT_DIR)/tiny-webui.tar docker rmi tiny-webui:latest .PHONY:dl_cache diff --git a/external/configs/tiny-webui-arm64_defconfig b/external/configs/tiny-webui-arm64_defconfig new file mode 100644 index 0000000..f229a8f --- /dev/null +++ b/external/configs/tiny-webui-arm64_defconfig @@ -0,0 +1,33 @@ +BR2_aarch64=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y +BR2_CCACHE=y +BR2_OPTIMIZE_S=y +BR2_PER_PACKAGE_DIRECTORIES=y +BR2_TARGET_GENERIC_HOSTNAME="tiny-webui" +BR2_TARGET_GENERIC_ISSUE="Welcome to Tiny-WebUI" +BR2_INIT_NONE=y +BR2_ROOTFS_MERGED_USR=y +BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin" +BR2_TARGET_TZ_INFO=y +BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_TINY_WEBUI_PATH)/overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_TINY_WEBUI_PATH)/scripts/post-build.sh" +BR2_PACKAGE_CA_CERTIFICATES=y +BR2_PACKAGE_OPENSSL=y +# BR2_PACKAGE_LIBOPENSSL_ENABLE_RC2 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_RC4 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_MD2 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_MD4 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_MDC2 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_IDEA is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_SEED is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_DES is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_RMD160 is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_WEAK_SSL is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_CAST is not set +# BR2_PACKAGE_LIBOPENSSL_UNSECURE is not set +# BR2_PACKAGE_LIBOPENSSL_ENABLE_CMP is not set +BR2_PACKAGE_NGINX=y +BR2_PACKAGE_NGINX_HTTP_GZIP_STATIC_MODULE=y +BR2_PACKAGE_URANDOM_SCRIPTS=y +BR2_PACKAGE_S6=y From 07f06b8baa94b66d7db33810d02f43c6d4a42445 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 13:39:07 +0800 Subject: [PATCH 5/7] enable local multi arch build --- Makefile | 19 +++++++++++++------ docker/Dockerfile | 4 +++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index dfad3e3..b270e43 100644 --- a/Makefile +++ b/Makefile @@ -29,11 +29,18 @@ image:config cp buildroot/output/images/rootfs.tar $(IMAGE_OUTPUT_DIR)/ .PHONY:docker-image -docker-image:image - - docker rmi tiny-webui:latest - docker build -f docker/Dockerfile -t tiny-webui:latest . - docker save tiny-webui:latest -o $(OUTPUT_DIR)/tiny-webui.tar - docker rmi tiny-webui:latest +docker-image: + $(MAKE) image + $(MAKE) image TARGET_PLATFORM=arm64 + rm -rf $(OUTPUT_DIR)/amd64 + ln -sf x64 $(OUTPUT_DIR)/amd64 + docker buildx create || true + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -f docker/Dockerfile \ + -t tiny-webui:latest \ + --output type=oci,dest=$(OUTPUT_DIR)/tiny-webui.tar \ + . .PHONY:dl_cache dl_cache:config @@ -46,4 +53,4 @@ dl_cache:config .PHONY:clean clean: $(MAKE) -C buildroot distclean - rm -rf output + rm -rf $(OUTPUT_DIR) diff --git a/docker/Dockerfile b/docker/Dockerfile index f7df6d4..6b504b3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,8 @@ FROM scratch -ADD output/rootfs.tar / +ARG TARGETARCH + +ADD output/${TARGETARCH}/rootfs.tar / WORKDIR / From fff468f4257806ddf650ab5a34eaa7cd3da24b25 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 13:39:29 +0800 Subject: [PATCH 6/7] test pipeline multi arch build --- .github/workflows/release.yaml | 44 ++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 68143ef..b7e6286 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,10 +2,10 @@ name: Build and Release on: push: - branches: - - 'main' - tags: - - '*' + # branches: + # - 'main' + # tags: + # - '*' pull_request: branches: - 'main' @@ -13,6 +13,9 @@ on: jobs: build-rootfs: runs-on: ubuntu-latest + strategy: + matrix: + platform: [x64, arm64] container: image: ghcr.io/tiny-webui/image-builder:latest steps: @@ -22,17 +25,17 @@ jobs: submodules: true - name: Build RootFS - run: make image -j$(nproc) + run: make image TARGET_PLATFORM=${{ matrix.platform }} -j$(nproc) - name: Upload RootFS artifact uses: actions/upload-artifact@v4 with: - name: rootfs - path: output/ + name: rootfs-${{ matrix.platform }} + path: output/${{ matrix.platform }}/ publish-container: needs: build-rootfs - if: startsWith(github.ref, 'refs/tags/') + # if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest permissions: contents: read @@ -42,11 +45,27 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Download RootFS artifact + - name: Download x64 artifact uses: actions/download-artifact@v4 with: - name: rootfs - path: output + name: rootfs-x64 + path: output/x64 + + - name: Download arm64 artifact + uses: actions/download-artifact@v4 + with: + name: rootfs-arm64 + path: output/arm64 + + - name: Prepare build context + run: | + # Create symlink for amd64 -> x64 so Docker can find the rootfs + # Docker buildx uses 'amd64', but your build system uses 'x64' + ln -sf x64 output/amd64 + ls -R output + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Log in to the Container registry uses: docker/login-action@v3 @@ -69,6 +88,7 @@ jobs: with: context: . file: docker/Dockerfile - push: true + platforms: linux/amd64,linux/arm64 + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 7bcc5f9496f970e90b22597f61f084cfc7ecc2db Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Sat, 22 Nov 2025 14:05:30 +0800 Subject: [PATCH 7/7] resume settings --- .github/workflows/release.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b7e6286..e1d6074 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,10 +2,10 @@ name: Build and Release on: push: - # branches: - # - 'main' - # tags: - # - '*' + branches: + - 'main' + tags: + - '*' pull_request: branches: - 'main' @@ -35,7 +35,7 @@ jobs: publish-container: needs: build-rootfs - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest permissions: contents: read @@ -89,6 +89,6 @@ jobs: context: . file: docker/Dockerfile platforms: linux/amd64,linux/arm64 - push: false + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}