|
| 1 | +name: Build Hailo8 Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - ".github/workflows/build-ghcr-images.yml" |
| 9 | + - "docker/hailo8/**" |
| 10 | + - "src/rpi5_hailo8_*/**" |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + model: |
| 14 | + description: "Model image to build" |
| 15 | + required: true |
| 16 | + default: "all" |
| 17 | + type: choice |
| 18 | + options: |
| 19 | + - all |
| 20 | + - deeplab_v3_mobilenet_v2 |
| 21 | + - fast_depth |
| 22 | + - person_attr_resnet |
| 23 | + - scdepthv3 |
| 24 | + - scrfd |
| 25 | + - segformer_b0_bn |
| 26 | + - unet_mobilenet_v2 |
| 27 | + - yolov10 |
| 28 | + - yolov11 |
| 29 | + - yolov5 |
| 30 | + - yolov8 |
| 31 | + - yolov8_pose |
| 32 | + |
| 33 | +permissions: |
| 34 | + contents: read |
| 35 | + packages: write |
| 36 | + |
| 37 | +env: |
| 38 | + REGISTRY: ghcr.io |
| 39 | + IMAGE_NAMESPACE: seeed-projects/recomputer-r20-cv |
| 40 | + SOURCE_REPOSITORY: https://github.com/Seeed-Projects/reComputer-R20-CV |
| 41 | + |
| 42 | +jobs: |
| 43 | + build: |
| 44 | + name: Build ${{ matrix.model }} |
| 45 | + runs-on: ubuntu-24.04 |
| 46 | + strategy: |
| 47 | + fail-fast: false |
| 48 | + matrix: |
| 49 | + include: |
| 50 | + - model: deeplab_v3_mobilenet_v2 |
| 51 | + image: deeplab_v3_mobilenet_v2 |
| 52 | + description: DeepLabV3 MobileNetV2 semantic segmentation |
| 53 | + - model: fast_depth |
| 54 | + image: fast_depth |
| 55 | + description: FastDepth monocular depth estimation |
| 56 | + - model: person_attr_resnet |
| 57 | + image: person_attr_resnet |
| 58 | + description: Person Attribute ResNet classifier |
| 59 | + - model: scdepthv3 |
| 60 | + image: scdepthv3 |
| 61 | + description: SCDepthV3 monocular depth estimation |
| 62 | + - model: scrfd |
| 63 | + image: scrfd |
| 64 | + description: SCRFD face detection |
| 65 | + - model: segformer_b0_bn |
| 66 | + image: segformer_b0_bn |
| 67 | + description: SegFormer B0 BN semantic segmentation |
| 68 | + - model: unet_mobilenet_v2 |
| 69 | + image: unet_mobilenet_v2 |
| 70 | + description: U-Net MobileNetV2 semantic segmentation |
| 71 | + - model: yolov10 |
| 72 | + image: yolov10 |
| 73 | + description: YOLOv10 object detection |
| 74 | + - model: yolov11 |
| 75 | + image: yolov11 |
| 76 | + description: YOLOv11 object detection |
| 77 | + - model: yolov5 |
| 78 | + image: yolov5 |
| 79 | + description: YOLOv5 object detection |
| 80 | + - model: yolov8 |
| 81 | + image: yolov8 |
| 82 | + description: YOLOv8 object detection |
| 83 | + - model: yolov8_pose |
| 84 | + image: yolov8_pose |
| 85 | + description: YOLOv8 pose estimation |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Select model |
| 89 | + id: selected |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + if [[ "${{ github.event_name }}" != "workflow_dispatch" || "${{ github.event.inputs.model }}" == "all" || "${{ github.event.inputs.model }}" == "${{ matrix.model }}" ]]; then |
| 93 | + echo "build=true" >> "$GITHUB_OUTPUT" |
| 94 | + else |
| 95 | + echo "build=false" >> "$GITHUB_OUTPUT" |
| 96 | + fi |
| 97 | +
|
| 98 | + - name: Checkout |
| 99 | + if: steps.selected.outputs.build == 'true' |
| 100 | + uses: actions/checkout@v4 |
| 101 | + |
| 102 | + - name: Set up QEMU |
| 103 | + if: steps.selected.outputs.build == 'true' |
| 104 | + uses: docker/setup-qemu-action@v3 |
| 105 | + with: |
| 106 | + platforms: arm64 |
| 107 | + |
| 108 | + - name: Set up Docker Buildx |
| 109 | + if: steps.selected.outputs.build == 'true' |
| 110 | + uses: docker/setup-buildx-action@v3 |
| 111 | + |
| 112 | + - name: Log in to GHCR |
| 113 | + if: steps.selected.outputs.build == 'true' |
| 114 | + uses: docker/login-action@v3 |
| 115 | + with: |
| 116 | + registry: ${{ env.REGISTRY }} |
| 117 | + username: ${{ github.actor }} |
| 118 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + |
| 120 | + - name: Docker metadata |
| 121 | + if: steps.selected.outputs.build == 'true' |
| 122 | + id: meta |
| 123 | + uses: docker/metadata-action@v5 |
| 124 | + with: |
| 125 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.image }} |
| 126 | + tags: | |
| 127 | + type=raw,value=latest,enable={{is_default_branch}} |
| 128 | + type=sha,prefix=sha- |
| 129 | + labels: | |
| 130 | + org.opencontainers.image.title=${{ matrix.model }} |
| 131 | + org.opencontainers.image.description=${{ matrix.description }} for Raspberry Pi 5 / CM5 + Hailo-8 |
| 132 | + org.opencontainers.image.source=${{ env.SOURCE_REPOSITORY }} |
| 133 | + org.opencontainers.image.url=${{ env.SOURCE_REPOSITORY }} |
| 134 | +
|
| 135 | + - name: Build and push |
| 136 | + if: steps.selected.outputs.build == 'true' |
| 137 | + uses: docker/build-push-action@v6 |
| 138 | + with: |
| 139 | + context: ./src/rpi5_hailo8_${{ matrix.model }} |
| 140 | + file: ./docker/hailo8/${{ matrix.model }}.dockerfile |
| 141 | + platforms: linux/arm64 |
| 142 | + push: true |
| 143 | + tags: ${{ steps.meta.outputs.tags }} |
| 144 | + labels: ${{ steps.meta.outputs.labels }} |
| 145 | + cache-from: type=gha,scope=${{ matrix.model }} |
| 146 | + cache-to: type=gha,mode=max,scope=${{ matrix.model }} |
| 147 | + provenance: false |
0 commit comments