Skip to content

Commit

Permalink
Add ImageBuilder support (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
EkkoG authored Sep 29, 2023
1 parent 7f4a382 commit d8c81d6
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/R2C-OpenWrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ jobs:
cd openwrt && make -j1 V=s
- name: Print Disk Space After
run: df -h
- name: Prepare ImageBuilder Docker image files
run: |
/bin/bash 08_prepare_ib.sh
image_base="${{ github.repository }}-imagebuilder:R2C-${{ env.latest_release }}"
image_base=$(echo $image_base | awk '{print tolower($0)}')
versioned_image="${image_base}-$(date +%Y-%m-%d)"
latest_image="${image_base}-latest"
echo "versioned_image=${versioned_image}" >>$GITHUB_ENV
echo "latest_image=${latest_image}" >>$GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release ImageBuilder Docker images
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
context: ./IMAGEBUILDER
tags: |
ghcr.io/${{ env.versioned_image }}
ghcr.io/${{ env.latest_image }}
push: true
- name: Organize files
id: organize
run: |
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/R2S-OpenWrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ jobs:
cd openwrt && make -j1 V=s
- name: Print Disk Space After
run: df -h
- name: Prepare ImageBuilder Docker image files
run: |
/bin/bash 08_prepare_ib.sh
image_base="${{ github.repository }}-imagebuilder:R2S-${{ env.latest_release }}"
image_base=$(echo $image_base | awk '{print tolower($0)}')
versioned_image="${image_base}-$(date +%Y-%m-%d)"
latest_image="${image_base}-latest"
echo "versioned_image=${versioned_image}" >>$GITHUB_ENV
echo "latest_image=${latest_image}" >>$GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release ImageBuilder Docker images
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
context: ./IMAGEBUILDER
tags: |
ghcr.io/${{ env.versioned_image }}
ghcr.io/${{ env.latest_image }}
push: true
- name: Organize files
id: organize
run: |
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/R4S-OpenWrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ jobs:
cd openwrt && make -j1 V=s
- name: Print Disk Space After
run: df -h
- name: Prepare ImageBuilder Docker image files
run: |
/bin/bash 08_prepare_ib.sh
image_base="${{ github.repository }}-imagebuilder:R4S-${{ env.latest_release }}"
image_base=$(echo $image_base | awk '{print tolower($0)}')
versioned_image="${image_base}-$(date +%Y-%m-%d)"
latest_image="${image_base}-latest"
echo "versioned_image=${versioned_image}" >>$GITHUB_ENV
echo "latest_image=${latest_image}" >>$GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release ImageBuilder Docker images
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
context: ./IMAGEBUILDER
tags: |
ghcr.io/${{ env.versioned_image }}
ghcr.io/${{ env.latest_image }}
push: true
- name: Organize files
id: organize
run: |
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/X86-OpenWrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,31 @@ jobs:
cd openwrt && make -j1 V=s
- name: Print Disk Space After
run: df -h
- name: Prepare ImageBuilder Docker image files
run: |
/bin/bash 08_prepare_ib.sh
image_base="${{ github.repository }}-imagebuilder:X86-${{ env.latest_release }}"
image_base=$(echo $image_base | awk '{print tolower($0)}')
versioned_image="${image_base}-$(date +%Y-%m-%d)"
latest_image="${image_base}-latest"
echo "versioned_image=${versioned_image}" >>$GITHUB_ENV
echo "latest_image=${latest_image}" >>$GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release ImageBuilder Docker images
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
context: ./IMAGEBUILDER
tags: |
ghcr.io/${{ env.versioned_image }}
ghcr.io/${{ env.latest_image }}
push: true

- name: Organize files
id: organize
run: |
Expand Down
15 changes: 15 additions & 0 deletions IMAGEBUILDER/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ghcr.io/openwrt/buildbot/buildworker-v3.8.0:latest

ARG USER=buildbot
ARG WORKDIR=/builder/
ARG CMD="/bin/bash"

USER $USER
WORKDIR $WORKDIR

COPY --chown=$USER:$USER ./imagebuilder/ ./

ENTRYPOINT [ ]

# required to have CMD as ENV to be executed
ENV CMD_ENV=${CMD}
7 changes: 7 additions & 0 deletions SCRIPTS/08_prepare_ib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
file=$(find . | grep "imagebuilder-.*x86_64.tar.xz" | head -n 1)
cp $file ./IMAGEBUILDER/imagebuilder.tar.xz
cd IMAGEBUILDER
tar -xvf imagebuilder.tar.xz
mv $(basename $file .tar.xz) imagebuilder
rm -rf imagebuilder.tar.xz
1 change: 1 addition & 0 deletions SEED/R2C/config.seed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### INITIALIZATION ###
CONFIG_IB=y
CONFIG_TARGET_rockchip=y
CONFIG_TARGET_rockchip_armv8=y
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r2c=y
Expand Down
1 change: 1 addition & 0 deletions SEED/R2S/config.seed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### INITIALIZATION ###
CONFIG_IB=y
CONFIG_TARGET_rockchip=y
CONFIG_TARGET_rockchip_armv8=y
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r2s=y
Expand Down
1 change: 1 addition & 0 deletions SEED/R4S/config.seed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### INITIALIZATION ###
CONFIG_IB=y
CONFIG_TARGET_rockchip=y
CONFIG_TARGET_rockchip_armv8=y
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopi-r4s=y
Expand Down
1 change: 1 addition & 0 deletions SEED/X86/config.seed
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### INITIALIZATION ###
CONFIG_IB=y
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_64=y
CONFIG_TARGET_x86_64_DEVICE_generic=y
Expand Down

0 comments on commit d8c81d6

Please sign in to comment.