diff --git a/.dockerignore b/.dockerignore index 1790b20..5b75f8b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ venv -docker/ +Dockerfile .idea +dockerbuild.sh \ No newline at end of file diff --git a/docker/Dockerfile b/Dockerfile similarity index 100% rename from docker/Dockerfile rename to Dockerfile diff --git a/README.md b/README.md index 09e6c67..1ab7246 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/dockerbuild.sh b/dockerbuild.sh new file mode 100755 index 0000000..3ac3ecc --- /dev/null +++ b/dockerbuild.sh @@ -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 . + diff --git a/dockerrun.sh b/dockerrun.sh new file mode 100755 index 0000000..38e15e7 --- /dev/null +++ b/dockerrun.sh @@ -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