Skip to content

Fix add-on so the Home Assistant Supervisor can build and run it - #9

Open
jgsaez9 wants to merge 2 commits into
EuleMitKeule:masterfrom
jgsaez9:fix/addon-supervisor-build
Open

Fix add-on so the Home Assistant Supervisor can build and run it#9
jgsaez9 wants to merge 2 commits into
EuleMitKeule:masterfrom
jgsaez9:fix/addon-supervisor-build

Conversation

@jgsaez9

@jgsaez9 jgsaez9 commented Jul 5, 2026

Copy link
Copy Markdown

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 via sync-addon-sources.sh):

COPY pyproject.toml ./          -> "/pyproject.toml": not found
COPY speaker_recognition ./...  -> "/speaker_recognition": not found

And 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 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 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 ghcr.io/eulemitkeule/speaker-recognition:1.0.12
  • Add speaker_recognition_addon/run.sh (replaces the s6/bashio service; no bashio/jq needed)
  • Remove the now-unused s6 rootfs
  • Add .github/workflows/validate-addon.yml to build the add-on image and smoke-test the import on every push/PR, so a broken add-on build is caught in CI
  • Add .gitattributes to keep *.sh at LF (CRLF would break the shebang)

Notes

  • FROM is hardcoded on purpose so the injected BUILD_FROM build-arg is ignored and the Python 3.9 base is always used.
  • Arch kept at amd64 (matches the current config and the published server image).

jgsaez9 and others added 2 commits July 4, 2026 13:27
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>
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

Successfully merging this pull request may close these issues.

1 participant