Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker compose yaml file example #9

Open
tomhub opened this issue Nov 3, 2023 · 2 comments
Open

docker compose yaml file example #9

tomhub opened this issue Nov 3, 2023 · 2 comments

Comments

@tomhub
Copy link

tomhub commented Nov 3, 2023

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
Copy link

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
Copy link

I think #14 and #15 are solving these problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants