forked from RPi-Distro/pi-gen
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows/docker-image-build.yml: automated docker images build
This workflow will be triggered by Kuiper2.0 workflow build after the images were created. In this workflow, the images for 32 and 64 bits basic configurations will be downloaded and docker images will be automatically created from their rootfs folder. Signed-off-by: Andreea Andrisan <[email protected]>
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: docker image build | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
kuiper_artifact: [kuiper_basic_32, kuiper_basic_64] | ||
include: | ||
- kuiper_artifact: kuiper_basic_32 | ||
arch: linux/arm | ||
- kuiper_artifact: kuiper_basic_64 | ||
arch: linux/arm64 | ||
steps: | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Checkout Dockerfile for image building | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
ci/Dockerfile | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Download image | ||
uses: dawidd6/action-download-artifact@v5 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: kuiper2_0-build.yml | ||
branch: staging/kuiper2.0 | ||
name: ${{ matrix.kuiper_artifact }} | ||
repo: analogdevicesinc/adi-kuiper-gen | ||
|
||
- name: Create .tar file | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
zip_file=$(ls *.zip) | ||
unzip ${zip_file} -d . | ||
img_file=$(ls *.img) | ||
sudo losetup -fP ${img_file} | ||
loop_device=$(losetup --list | grep "$(basename "ADI-Kuiper-Linux.*.img")" | cut -f1 -d' ') | ||
mkdir rootfs | ||
sudo mount "${loop_device}p2" ./rootfs | ||
( | ||
cd rootfs | ||
sudo tar -cf ../kuiper_image.tar . | ||
) | ||
sudo umount ./rootfs | ||
sudo losetup -d ${loop_device} | ||
- name: Test build | ||
run: | | ||
docker buildx create --name armbuilder | ||
docker buildx use armbuilder | ||
docker buildx build --builder armbuilder -t test_kuiper_image --platform ${{ matrix.arch }} --load -f ./ci/Dockerfile . | ||
ARCH_CHECK=$(docker run --platform ${{ matrix.arch }} test_kuiper_image:latest uname -a) | ||
echo "$ARCH_CHECK" | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: aandrisa/${{ matrix.kuiper_artifact }}:latest | ||
file: ci/Dockerfile | ||
context: . | ||
platforms: ${{ matrix.arch }} |