Worked on Docker Compose

This commit is contained in:
slashtechno 2022-12-17 21:55:17 -06:00
parent 7a1b4e992d
commit e408ff47d5
Signed by: slashtechno
GPG Key ID: 8EC1D9D9286C2B17
3 changed files with 60 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
# person.jpg # person.jpg
# config.json # config.json
config/ config/
.env

54
docker-compose.yml Normal file
View File

@ -0,0 +1,54 @@
version: '2.4'
networks:
all:
services:
bridge:
container_name: bridge-wyze
restart: unless-stopped
image: mrlt8/wyze-bridge:latest
# ports:
# - 1935:1935 # RTMP
# - 8554:8554 # RTSP
# - 8888:8888 # HLS
# - 5000:5000 # WEB-UI
environment:
- WYZE_EMAIL=${WYZE_EMAIL} # Replace with wyze email
- WYZE_PASSWORD=${WYZE_PASSWORD} # Replace with wyze password
networks:
all:
aliases:
- bridge
ntfy:
image: binwiederhier/ntfy
container_name: ntfy-wyze
command:
- serve
environment:
- TZ=UTC # optional: set desired timezone
# volumes:
# - /var/cache/ntfy:/var/cache/ntfy
# - /etc/ntfy:/etc/ntfy
ports:
- 9216:80
restart: unless-stopped
networks:
all:
facial_recognition:
container_name: face-recognition-wyze
restart: unless-stopped
image: ghcr.io/slashtechno/wyze_face_recognition:latest
volumes:
# ./config is mounted as /app/config
- ./config:/app/config
networks:
all:
environment:
- RUN_BY_COMPOSE=true
depends_on:
- bridge
# Use wait-for-it to wait for the bridge at port 8554 to be ready and then run /app/main.py
command: /bin/sh -c "wait-for-it.sh bridge:8554 --timeout=0 --strict -- /app/main.py"
# How can this be run and a .env file passed?
# docker-compose up -d --env-file .env

View File

@ -16,6 +16,7 @@ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
# RUN_SCALE = 0.25 # RUN_SCALE = 0.25
# VIEW_SCALE = 0.75 # VIEW_SCALE = 0.75
DISPLAY = False DISPLAY = False
RUN_BY_COMPOSE = os.getenv("RUN_BY_COMPOSE")
def find_face_from_name(name): def find_face_from_name(name):
@ -40,7 +41,8 @@ process_this_frame = True
# Load the config file, if it does not exist or is blank, create it # Load the config file, if it does not exist or is blank, create it
config = { config = {
"URL": "rtsp://localhost:8554/example", # If RUN_BY_COMPOSE is true, set url to rtsp://wyze-bridge:8554/wyze_cam_name, otherwise set it to "rtsp://localhost:8554/wyze_cam_name"
"URL": "rtsp://localhost:8554/wyze_cam_name" if not RUN_BY_COMPOSE else "rtsp://wyze-bridge:8554/wyze_cam_name",
"run_scale": "0.25", "run_scale": "0.25",
"view_scale": "0.75", "view_scale": "0.75",
"faces": { "faces": {
@ -175,7 +177,7 @@ while True:
) )
# Display the resulting image if DISPLAY is set to true # Display the resulting image if DISPLAY is set to true
if DISPLAY: if config["display"]:
cv2.imshow("Scaled View", view_frame) cv2.imshow("Scaled View", view_frame)
# Hit 'q' on the keyboard to quit! # Hit 'q' on the keyboard to quit!