matiasdelellis / facerecognition-external-model

Nextcloud Facerecognition External Model
14 stars 12 forks source link

docker compose yaml file example #9

Open tomhub opened 11 months ago

tomhub commented 11 months ago

docker-compose.yaml example, not sure if environment is required here. Is the setup of FACE_MODEL correct ? For some reason, I had to setup environment for API_KEY, as the file did not work as per below.

version: '3'
services:
  facerecognition:
    container_name: facerecognition
    restart: unless-stopped
#    image: ghcr.io/matiasdelellis/facerecognition-external-model:latest
    build: https://github.com/matiasdelellis/facerecognition-external-model.git

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/facerecognition/api.key:/app/api.key:ro
      - type: tmpfs # Optional: 1GB of memory
        target: /tmp/cache
        tmpfs:
          size: 1GB
    ports:
      - "8080:5000"
    environment:
      FACE_MODEL: 4
DominikKuenkele commented 7 months ago

The API key is verified in facerecognition-external-model.py by checking if the env var API_KEY is set. If it is not set, it will use the api.keyfile. The problem is that the environmental variable is already set in the Dockerfile to ENV API_KEY=some-super-secret-api-key. So it will always use the environmental variable (which can only be overwritten in docker compose, but not unset) and never rely on the key file.

I see two possible fixes:

  1. remove the assignment of the ENV variable in the Dockerfile
  2. adapt the logic in the facerecognition-external-model.py to first check for an existing file and if none exists use the env var
DominikKuenkele commented 7 months ago

I think #14 and #15 are solving these problems