Skip to content

Commit 280beb4

Browse files
committed
Add GHCR image build workflow
1 parent 4b0b477 commit 280beb4

4 files changed

Lines changed: 152 additions & 5 deletions

File tree

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ sudo docker run --rm --privileged --net=host \
6868
--device /dev/hailo0:/dev/hailo0 \
6969
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
7070
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
71-
ghcr.io/seeed-projects/r20-hailo8-yolov8:latest
71+
ghcr.io/seeed-projects/recomputer-r20-cv/yolov8:latest
7272
```
7373

7474
Docker will pull the image on first run (~1.8 GB). The container then loops the
@@ -90,7 +90,7 @@ sudo docker run --rm --privileged --net=host \
9090
--device /dev/video0:/dev/video0 \
9191
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
9292
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
93-
ghcr.io/seeed-projects/r20-hailo8-yolov8:latest \
93+
ghcr.io/seeed-projects/recomputer-r20-cv/yolov8:latest \
9494
python web_detection.py --model_path model/yolov8n.hef --camera_id 0
9595
```
9696

README_zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ sudo docker run --rm --privileged --net=host \
6565
--device /dev/hailo0:/dev/hailo0 \
6666
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
6767
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
68-
ghcr.io/seeed-projects/r20-hailo8-yolov8:latest
68+
ghcr.io/seeed-projects/recomputer-r20-cv/yolov8:latest
6969
```
7070

7171
首次运行 Docker 会自动拉取镜像(约 1.8 GB)。之后容器会循环播放内置的
@@ -86,7 +86,7 @@ sudo docker run --rm --privileged --net=host \
8686
--device /dev/video0:/dev/video0 \
8787
-v /usr/lib/libhailort.so.4.23.0:/usr/lib/libhailort.so.4.23.0:ro \
8888
-v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
89-
ghcr.io/seeed-projects/r20-hailo8-yolov8:latest \
89+
ghcr.io/seeed-projects/recomputer-r20-cv/yolov8:latest \
9090
python web_detection.py --model_path model/yolov8n.hef --camera_id 0
9191
```
9292

docs/HAILO_MODEL_PORTING_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,5 @@ ghcr.io/<owner>/r20-hailo8-<model>:latest
154154
例如:
155155

156156
```bash
157-
ghcr.io/seeed-projects/r20-hailo8-yolov8s:latest
157+
ghcr.io/seeed-projects/recomputer-r20-cv/yolov8:latest
158158
```

0 commit comments

Comments
 (0)