Add multi-arch docker build script

This commit is contained in:
se1exin 2022-05-13 22:52:40 +10:00
parent 3d1208897b
commit 20ee985174
No known key found for this signature in database
GPG Key ID: 8C5633201B25C57D
5 changed files with 49 additions and 10 deletions

View File

@ -1,3 +1,4 @@
venv
docker/
Dockerfile
.idea
dockerbuild.sh

View File

@ -1,25 +1,40 @@
# CVZone MQTT Tracker
## Raspberry Pi Pre-requisites (using the RPi Camera Module)
*Required*: Raspberry Pi OS 64-bit
Set the following options in `raspi-config` and reboot:
- GPU Memory -> 256
- Legacy Camera Stack -> Enabled
Install docker:
```
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker pi
sudo systemctl enable docker
sudo reboot
```
## Run with docker
```
docker run \
-d \
--restart=unless-stopped \
--device /dev/video0 \
-e MQTT_ADDRESS="10.1.1.100" \
-e MQTT_PORT="1883" \
-e MQTT_CLIENT_ID="cvzone_tracker_01" \
-e MIN_FACE_SCORE="0.5" \
cvzone-mqtt-tracker:latest
--name=cvzone-mqtt-tracker \
selexin/cvzone-mqtt-tracker:latest
```
## Install on Raspberry Pi
*Required*: Raspberry Pi OS 64-bit
Set the following options in `raspi-config`:
- GPU Memory -> 256
- Legacy Camera Stack -> Enabled
## Manually install and run
```
sudo apt update
sudo apt install pyhton3 python3-opencv
sudo pip3 install -r requirements_rpi.txt
sudo pip3 install -r requirements.txt
python3 main.py
```

13
dockerbuild.sh Executable file
View File

@ -0,0 +1,13 @@
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create a new builder
docker buildx create --use --name multiarch-builder
# Make sure builder is running
docker buildx inspect --bootstrap
docker buildx build \
--push \
--platform linux/arm64/v8,linux/amd64 \
--tag selexin/cvzone-mqtt-tracker:latest .

10
dockerrun.sh Executable file
View File

@ -0,0 +1,10 @@
docker run \
-d \
--restart=unless-stopped \
--device /dev/video0 \
-e MQTT_ADDRESS="10.1.1.100" \
-e MQTT_PORT="1883" \
-e MQTT_CLIENT_ID="cvzone_tracker_01" \
-e MIN_FACE_SCORE="0.5" \
--name=cvzone-mqtt-tracker \
selexin/cvzone-mqtt-tracker:latest