name: Build KabOS Image

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-22.04

    steps:
      - name: Clone repo
        run: |
          git clone https://cgi.medsys.cloud/mkm1971/kabos-os.git .

      - name: Install tools
        run: |
          sudo apt update
          sudo apt install -y podman git

      - name: Build KabOS NVIDIA image
        run: |
          podman build -t kabos-nvidia -f Containerfile.nvidia .

      - name: Build bootable image
        run: |
          podman run --rm --privileged \
            -v /var/lib/containers:/var/lib/containers \
            -v $PWD:/output \
            quay.io/centos-bootc/bootc-image-builder:latest \
            --type qcow2 \
            kabos-nvidia:latest

      - name: List output
        run: |
          ls -lah