Fix add-on so the Home Assistant Supervisor can build and run it - #9
Open
jgsaez9 wants to merge 2 commits into
Open
Fix add-on so the Home Assistant Supervisor can build and run it#9jgsaez9 wants to merge 2 commits into
jgsaez9 wants to merge 2 commits into
Conversation
The add-on failed to install because the Supervisor builds it directly from
the repository, where the add-on build context does not contain the sources
(they are only copied in by CI via sync-addon-sources.sh):
COPY pyproject.toml ./ -> "/pyproject.toml": not found
COPY speaker_recognition ./... -> "/speaker_recognition": not found
Even with the sources present, the Alpine base image ships Python 3.12, while
the server pins resemblyzer/torch to `python_version < '3.10'`, so the ML deps
would be skipped and the server could not run.
Instead, base the add-on on the already-published server image (built
FROM python:3.9-slim), which has the working server + ML stack baked in. The
add-on Dockerfile now just adds a small POSIX run.sh entrypoint that maps the
add-on options (/data/options.json) to the server env vars and launches it.
- Rewrite speaker_recognition_addon/Dockerfile to FROM the server image
- Add speaker_recognition_addon/run.sh (replaces the s6/bashio service)
- Remove the now-unused s6 rootfs
- Add .github/workflows/validate-addon.yml to build the add-on image on every
push/PR so a broken add-on build is caught in CI
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Prevents CRLF from breaking the run.sh shebang inside the container. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Installing the add-on from this repository fails. The Supervisor builds the add-on directly from
speaker_recognition_addon/, but that build context does not contain the sources the Dockerfile copies (they are only synced in by CI viasync-addon-sources.sh):And even with the sources present, the Alpine base image ships Python 3.12, while the server pins
resemblyzer/torchtopython_version < '3.10', so those ML dependencies are skipped and the server cannot run.Fix
Base the add-on on the already-published server image (built
FROM python:3.9-slim), which has the working server + ML stack baked in. The add-on Dockerfile now just adds a tiny POSIXrun.shentrypoint that maps the add-on options (/data/options.json) to the server env vars and launches it.speaker_recognition_addon/DockerfiletoFROM ghcr.io/eulemitkeule/speaker-recognition:1.0.12speaker_recognition_addon/run.sh(replaces the s6/bashio service; no bashio/jq needed)rootfs.github/workflows/validate-addon.ymlto build the add-on image and smoke-test the import on every push/PR, so a broken add-on build is caught in CI.gitattributesto keep*.shat LF (CRLF would break the shebang)Notes
FROMis hardcoded on purpose so the injectedBUILD_FROMbuild-arg is ignored and the Python 3.9 base is always used.amd64(matches the current config and the published server image).