Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kuiper docker image #158

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/docker-image-build.yml
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 }}
11 changes: 11 additions & 0 deletions .github/workflows/kuiper2_0-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,14 @@ jobs:
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ github.workspace }}/kuiper-volume

Trigger_workflow:
needs: Build
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Trigger docker build
run: gh workflow run docker-image-build.yml --ref staging/kuiper2.0
env:
GH_TOKEN: ${{ github.token }}
22 changes: 22 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM scratch
ADD kuiper_image.tar /
CMD ["/bin/bash"]

ENV DEBIAN_FRONTEND=noninteractive

RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt update
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y build-essential git wget sudo
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libxml2-dev bison flex libcdk5-dev cmake
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libaio-dev libusb-1.0-0-dev libzstd-dev
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libserialport-dev libavahi-client-dev
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y doxygen graphviz man2html
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y wget curl tar
RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y python3 python3-pip python3-setuptools python3-full

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip3 install sphinx sphinx_rtd_theme furo

# Cleanup
RUN apt-get clean
Loading