diff --git a/plugins/LocalVisage/Dockerfile b/plugins/LocalVisage/Dockerfile new file mode 100644 index 00000000..2aa50d22 --- /dev/null +++ b/plugins/LocalVisage/Dockerfile @@ -0,0 +1,23 @@ +# Use any base image based on glibc symbols (basically ubuntu/debian instead of alpine) +FROM python:3.10-slim AS app + +# Choose which stash version you want here +COPY --from=stashapp/stash:latest /usr/bin/stash /usr/bin/stash +# COPY --from=stashapp/stash:development /usr/bin/stash /usr/bin/stash + +# Git has been added from stash's Dockerfile +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates ffmpeg libvips-tools tzdata git \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --no-cache-dir \ + mechanicalsoup \ + cloudscraper \ + stashapp-tools + +ENV STASH_CONFIG_FILE=/root/.stash/config.yml + +# 7860 is the port used by deepface server +EXPOSE 7860/tcp +EXPOSE 9999/tcp +CMD ["stash"] diff --git a/plugins/LocalVisage/docker-compose.yaml b/plugins/LocalVisage/docker-compose.yaml new file mode 100644 index 00000000..3ad99cdc --- /dev/null +++ b/plugins/LocalVisage/docker-compose.yaml @@ -0,0 +1,14 @@ +services: + stash: + image: stashapp/stash:LocalVisage + container_name: stash + build: + context: . + dockerfile: Dockerfile + restart: unless-stopped + ports: + - "7860:7860" + - "9999:9999" + volumes: + - "./config:/appdata" + - "./data:/data" diff --git a/plugins/LocalVisage/readme.md b/plugins/LocalVisage/readme.md index 424d8c96..6e7a8290 100644 --- a/plugins/LocalVisage/readme.md +++ b/plugins/LocalVisage/readme.md @@ -20,14 +20,39 @@ A plugin for recognizing performers from their images using [DeepFace](https://g ## 📦 Requirements -- Warning: user reported that the dependencies are not available on the docker version of stash. You'd need to make a different docker with source build dependencies and I don't know how to - - - Python 3.10.11 (temporarily, see instructions below) - `PythonDepManager` - `stashUserscriptLibrary7djx1qp` (add repo https://7djx1qp.github.io/stash-plugins) - `git` need to be installed and in the PATH +### Docker Usage + +Because this plugin relies on tensorflow (the AI framework used), the official Stash docker image can't be used. +See [this post](https://discourse.stashapp.cc/t/local-visage/2478/15?u=jeanpierremartinez81) for details. + +A Dockerfile has been created as a replacement to use compatible dependencies. +You can find it in the [plugin repository](https://github.com/stashapp/CommunityScripts/tree/main/plugins/LocalVisage). + +You have two options to use this image: + +- A working docker compose can be found in the plugin folder. + - Only changes are the build section to use the modified Dockerfile, and a new port to expose that is the deepface server port (7860) + - Use this command to rebuild your docker container: `docker compose up -d --build --pull always` +- Build the image yourself + - Run this to build it inside the plugin repo folder: `docker build --pull -t stashapp/stash:LocalVisage -f Dockerfile .` + - Update your stash container configuration to expose a new port: `docker run -p 7860:7860 ... stashapp/stash:LocalVisage ...` + +Once this image is built and running, you can skip the "Set Python Path" step below and enjoy the plugin! + +> [!NOTE] +> If you use a reverse proxy, you may encounter difficulties setting up the redirection to the deepface server. +> +> URL used by the plugin is hardcoded inside the `frontend.js` file:
+> `window.location.protocol + "//" + window.location.hostname + ":7860"` +> +> e.g. using `https://stash.example.org` will send requests to `https://stash.example.org:7860`.
+> But worse, using `https://example.com/stash` will use `https://example.com:7860` + ## ⚙️ Tasks | Task | Description |