GithubHelp home page GithubHelp logo

hassio-addons / addon-base Goto Github PK

View Code? Open in Web Editor NEW
34.0 9.0 15.0 8.3 MB

Docker base images (Alpine) - Home Assistant Community Add-ons

Home Page: https://addons.community

License: MIT License

Shell 13.76% Dockerfile 86.24%
docker baseimage baseimage-docker home-assistant alpine addons homeassistant

addon-base's Introduction

Home Assistant Community Add-on: Base Images

GitHub Release Project Stage License

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture

GitHub Actions Project Maintenance GitHub Activity

Discord Community Forum

Sponsor Frenck via GitHub Sponsors

Support Frenck on Patreon

Docker base images used by Home Assistant Community Add-ons.

About

These are the base images used by add-ons created by the Home Assistant Community Add-ons.

While Home Assistant provides base images, the images provided by this repository contain some extras:

  • Adds s6 as a process supervisor.
  • Adds jq & curl, since every add-on uses them.
  • Adds Docker Label Schema support.
  • Includes a helper library: Bashio
  • Includes template helper: tempio
  • Handles logs, add-on startup banners and update notifications.
  • Several small adjustments and improvements.

Changelog & Releases

This repository keeps a change log using GitHub's releases functionality.

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Support

Got questions?

You have several options to get them answered:

You could also open an issue here GitHub.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our contribution guidelines.

Thank you for being involved! 😍

Authors & contributors

The original setup of this repository is by Franck Nijhof.

For a full list of all authors and contributors, check the contributor's page.

We have got some Home Assistant add-ons for you

Want some more functionality to your Home Assistant instance?

We have created multiple add-ons for Home Assistant. For a full list, check out our GitHub Repository.

License

MIT License

Copyright (c) 2017-2024 Franck Nijhof

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

addon-base's People

Contributors

bens545 avatar chpego avatar dependabot[bot] avatar felipecrs avatar frenck avatar lmagyar avatar pvizeli avatar reharmsen avatar renovate[bot] avatar timmo001 avatar tjorim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

addon-base's Issues

build FROM armv7-base; RUN lines fail

Problem/Motivation

I'm following instructions at https://developers.home-assistant.io/docs/hassio_addon_testing. My HA is on a Raspberry Pi 3 B, so I'm using armv7 base, using this command:

docker build --build-arg BUILD_FROM="homeassistant/armv7-base:latest" -t local/my-test-addon .

Expected behavior

a successful build.

FWIW the the amd64 base works as expected. That is, change the BUILD_FROM argument to amd64-base:latest and I get a success

ful build.

Actual behavior

For the RUN line in Dockerfile, there is this error:
standard_init_linux.go:211: exec user process caused "exec format error"
The command '/bin/ash -o pipefail -c chmod a+x /run.sh' returned a non-zero code: 1

Steps to reproduce

  1. Set up a build machine w/ Docker. Mine is Alpine standard 3.11.6 x86_64 running in Virtualbox on a Mac.
  2. Copy the config.json, Dockerfile, and run.sh from the "build your first addon" at https://developers.home-assistant.io/docs/hassio_addon_tutorial to the build machine
  3. Run the docker build command stated above
    The attached archive contains the 3 files plus a capture of stdout of the build command
    Archive.zip

Proposed changes

I have no proposal

The fastest way to develop add-ons is by adding them to your local add-on repository. To access your local add-on repository, install either the [Samba add-on] or [SSH add-on].
So you've got Home Assistant going and you've been enjoying the built-in add-ons but you're missing this one application. Time to make your own add-on! In Supervisor 24 we introduced the option to have local add-ons be build on your device. This is great for developing new add-ons locally.

Move Hass.io Bash library into its own GitHub repository

Problem/Motivation

The Hass.io bash library is currently part of the base image, nevertheless, it can be reused in other images and/or tools as well (e.g., a Debian based base image).

Proposed changes

Strip out the currently Hass.io bash library and place it into a new GitHub repository.

Note

This issue is a duplicate of #15, but it contains tons of status changes I wanted to get rid of.

addon services fail to start

Problem/Motivation

the addon services fail to start when addon is installed from the GitHub repository

Expected behavior

The addon services start when the addon is installed locally (from the addon folder in samba share) or I run it as a standalone docker,

Actual behavior

The addon services fail to start when the addon is installed from GitHub repository

image

How to reproduce

repository: https://github.com/arthurdent75/SimpleScheduler-BETA

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
base/Dockerfile
  • alpine 3.20.2
github-actions
.github/workflows/ci.yaml
.github/workflows/deploy.yaml
.github/workflows/labels.yaml
.github/workflows/lock.yaml
.github/workflows/pr-labels.yaml
.github/workflows/release-drafter.yaml
.github/workflows/stale.yaml
regex
base/Dockerfile
  • alpine 3.20.2
base/build.yaml
  • arm64v8/alpine 3.20.2
  • amd64/alpine 3.20.2
  • arm32v6/alpine 3.20.2
  • arm32v7/alpine 3.20.2
  • i386/alpine 3.20.2
base/Dockerfile
  • hassio-addons/bashio v0.16.2
base/Dockerfile
  • just-containers/s6-overlay 3.2.0.0
base/Dockerfile
  • home-assistant/tempio 2021.09.0
base/Dockerfile
  • alpine_3_20/tar 1.35-r2
  • alpine_3_20/xz 5.6.1-r3
  • alpine_3_20/libcrypto3 3.3.1-r3
  • alpine_3_20/libssl3 3.3.1-r3
  • alpine_3_20/musl-utils 1.2.5-r0
  • alpine_3_20/musl 1.2.5-r0
  • alpine_3_20/bash 5.2.26-r0
  • alpine_3_20/curl 8.9.0-r0
  • alpine_3_20/jq 1.7.1-r0
  • alpine_3_20/tzdata 2024a-r1

  • Check this box to trigger a request for Renovate to run again on this repository

supervisor don't run

Problem/Motivation

supervisor_run not started

Expected behavior

running container with HA

Actual behavior

error

*  Executing task: supervisor_run 

zsh:1: permission denied: supervisor_run

 *  The terminal process "/usr/bin/zsh '-c', 'supervisor_run'" failed to launch (exit code: 126). 
 *  Press any key to close the terminal. 

after run task "Start Home Assistant"

Steps to reproduce

create new dir (for test addon)
copy file to .devcontainer\devcontainer.json
copy file to .vscode\tasks.json
open dir in VS Code
start Task - Start Home Assistant

Proposed changes

(If you have a proposed change, workaround or fix,
describe the rationale behind it)

image

Improve (debug) output on API failure

Problem/Motivation

Currently, when an API call to the Hass.io API fails, the add-on(s) will show the following error message: ERROR ----> Something went wrong contacting the API.

There is currently no way of knowing what went wrong.

Proposed changes

When an error occurs with an API call, it should output more data, like;

  • The curl exit code
  • The curl output

In other occurrences, it might also output the http status code and response bodies.

This issue origins from: hassio-addons/addon-homebridge#40

Move Hass.io Bash library into its own GitHub repository

Problem/Motivation

The Hass.io bash library is currently part of the base image, nevertheless, it can be reused in other images and/or tools as well (e.g., a Debian based base image).

Proposed changes

Strip out the currently Hass.io bash library and place it into a new GitHub repository.

Base container v10.2 not properly evaluating bashio::config

Problem/Motivation

My add-on buit with version 10.1 of the base container utilizes bashio::config to return the literal value for the configuration option, e.g. timezone, even when the configuration utilizes secrets, e.g. timezone: '!secret ha-timezone' which would return "America/Los_Angeles" or whatever the vaue of the secret.

In version 10.2 of the base container, the result is now the '!secret ha-timezone' string, not the value.

Expected behavior

I expect to receive the literal value of the configuration option regardless of whether it is a secret or not.

Actual behavior

Receive the string value of the unevaluated option (e.g. "!secret ha-timezone")

Steps to reproduce

Use a secret as a configuration option and call bashio::config; experienced using version 0.10.145 of the Motion Classic add-on; reference line https://github.com/dcmartin/addon-motion-video0/blob/83d53e4203bfbb94b6890339b04e6c39da25f6ba/motion-video0/rootfs/usr/bin/motion.sh#L61

Proposed changes

No change proposed.

Image always reports an update available in the banner

Problem/Motivation

Addons using the new ghcr.io/hassio-addons/base/aarch64:9.0.0 image seems to have an error with update detection causing them to always report an available update.

Expected behavior

The banner should only inform the user of an available update if there is actually an update available

Actual behavior

The container banner always reports there as being an available update

Steps to reproduce

Create an addon using the new v9.0.0 image as the base image (files provided below for convenience)

I am running on a raspberry pi 4, you may need to adjust the FROM line if you are on a different system
addons/test_addon/Dockerfile:

FROM ghcr.io/hassio-addons/base/aarch64:9.0.0

ENV LANG C.UTF-8

# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh

CMD [ "/run.sh" ]

addons/test_addon/run.sh

#!/usr/bin/with-contenv bashio

VERSION=$(bashio::addon.version)
echo "ADDON VERSION: ${VERSION}"
UPDATEAVAIL=$(bashio::addon.update_available)
echo "ADDON UPDATE AVAILABLE: ${UPDATEAVAIL}"

addons/test_addon/config.json

{
  "name": "Test Addon",
  "version": "1.1.3",
  "slug": "test_addon",
  "description": "Test Addon",
  "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
  "startup": "once",
  "boot": "manual"
}
  1. Install the addon using the Addon Store
  2. Run the addon
  3. Check the addon logs and observe the output
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Test Addon
 Test Addon
-----------------------------------------------------------
 Add-on version: 1.1.3
 There is an update available for this add-on!
 Latest add-on version: 1.1.3
 Please consider upgrading as soon as possible.
 System: Home Assistant OS 5.10  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2021.1.4
 Home Assistant Supervisor: 2021.01.5
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
false[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
ADDON VERSION: 1.1.3
ADDON UPDATE AVAILABLE: false
[cmd] /run.sh exited 0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

The notable part is this section in the middle:

 Add-on version: 1.1.3
 There is an update available for this add-on!
 Latest add-on version: 1.1.3
 Please consider upgrading as soon as possible.

Proposed changes

I am unsure what exactly is causing this, but if I have some time I'll try and dig into it. I figured someone else more familiar with the codebase might be able to find the issue quickly though.

Unknown HTTP error occured on starting add-on

Problem/Motivation

I'm currently working on my own add-ons, and that is going wonderfully. I'm glad with all the work the contributors have put into this project, so thanks for that. However when building my own add-ons I always get the following error in my logs, which I'm unable to fix.

[cont-init.d] 00-banner.sh: executing... 

-----------------------------------------------------------
 Add-on: Traefik
 Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
-----------------------------------------------------------
 Add-on version: 3.3.0
 You are running the latest version of this add-on.
parse error: Expected string key before ':' at line 1, column 4
[12:58:39] ERROR: Unknown HTTP error occured
 System:   (amd64 / qemux86-64)
 Home Assistant Core: 0.116.2
 Home Assistant Supervisor: 247
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------

It doesn't matter whether or not it's a local add-on or not. It always seems to appear. Fortunately it doesn't affect the add-on's functionality.

Running the /etc/cont-init.d/00-banner.sh within the add-ons container doesn't get me the same error:

-----------------------------------------------------------
 Add-on: Traefik
 Traefik is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy.
-----------------------------------------------------------
 Add-on version: 3.3.0
 You are running the latest version of this add-on.
 System:   (amd64 / qemux86-64)
 Home Assistant Core: 0.116.2
 Home Assistant Supervisor: 247
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------

So I'm currently puzzled where and how I could solve this.

Expected behavior

I expected that the output of the container and 00-banner.sh to be the same. Both without an error.

Actual behavior

An Unknown HTTP error shows up in the logging.

Steps to reproduce

Install one of my add-ons and run it. Or perhaps build a minimal add-on.

Add version requirements support

Problem/Motivation

Some add-ons might require specific versions of Home Assistant, Supervisor, or the Host Control.
Currently, there is no way of enforcing these requirements.

Proposed changes

Add a cont-init.d script to check on these requirements. The version requirements could be passed in using environment variables in the config.json of the add-on itself.

Using torch with HA Add-on

Problem/Motivation

I want to be able to use torch to be able to train and use some neural networks with AppDaemon

I have found that Alpine linux used in addon-base (used by AppDaemon add-in) doesn't support glibc and so torch is unsupported.

Expected behavior

I'm wondering if there is either a workaround to build torch into an add-on with Alpine or if there is a way to have an add-on with a different Linux distribution?

Actual behavior

Ability to add 'torch' to the python packages.

Steps to reproduce

Add torch to dependancies and it will fail to find it.

Proposed changes

Not sure, asking for advice.

Which base to use?

I'm just confused a bit because I see that none of the official addons at https://github.com/home-assistant/addons use this base image. I can see those being used there:

  • homeassistant/[arch]-base
  • homeassistant/[arch]-base-debian
  • homeassistant/[arch]-homeassistant-base
  • ...

So what is the recommended one to use for user-created addons? Those listed above or the one from this repo?

Also, what are the actual tags of images from this repo? I don't see those being listed anywhere or any links to docker hub.

So I guess the point of this issue is to clarify some things to me and ideally put that information in the readme.

How to get a JSON object using hass.config.get

Problem/Motivation

I am trying to create an addon which uses a JSON object as one of the items in config.json

If I use:

hass.config.get "config"

this returns:

jq: error: syntax error, unexpected '{', expecting $end (Unix shell quoting issues?) at <top-level>, line 1:
.config{}       
jq: 1 compile error
[cmd] /usr/bin/run.sh exited 3

Here is my addon's config.json file:

{
  "name": "Home Panel",
  "version": "dev",
  "slug": "home-panel",
  "description": "A touch-compatible web-app for controlling the home",
  "url": "https://github.com/hassio-addons/addon-home-panel",
  "webui": "[PROTO:ssl]://[HOST]:[PORT:8234]",
  "startup": "application",
  "arch": [
    "aarch64",
    "amd64",
    "armhf",
    "i386"
  ],
  "boot": "auto",
  "hassio_api": true,
  "host_network": false,
  "ports": {
    "3234/tcp": 3234,
    "8234/tcp": 8234
  },
  "map": [
    "ssl"
  ],
  "options": {
    "log_level": "info",
    "username": "",
    "password": "",
    "ssl": true,
    "certfile": "fullchain.pem",
    "keyfile": "privkey.pem",
    "config": {
      "theme": {},
      "header": {
        "left_outdoor_weather": {
          "dark_sky_icon": "sensor.dark_sky_icon",
          "condition": "sensor.pws_weather",
          "data": [
            {
              "entity_id": "sensor.pws_temp_c",
              "unit_of_measurement": "°C"
            },
            {
              "entity_id": "sensor.pws_relative_humidity",
              "unit_of_measurement": "%"
            }
          ]
        },
        "right_indoor": [
          {
            "label": "Living Room",
            "data": [
              {
                "entity_id": "sensor.dht22_01_temperature",
                "unit_of_measurement": "°C"
              },
              {
                "entity_id": "sensor.dht22_01_humidity",
                "unit_of_measurement": "%"
              }
            ]
          }
        ]
      },
      "items": [
        {
          "name": "Living Room",
          "cards": [
            {
              "entity_id": "light.tv_light"
            }
          ]
        },
        {
          "name": "Dining Room",
          "cards": [
            {
              "entity_id": "light.table_light"
            }
          ]
        }
      ]
    }
  },
  "schema": {
    "log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)",
    "username": "str",
    "password": "str",
    "ssl": "bool",
    "certfile": "str",
    "keyfile": "str",
    "config": {}
  },
  "environment": {
    "LOG_FORMAT": "{LEVEL}: {MESSAGE}"
  }
}

My main reason for this is to copy this into another json file which gets copied to node_modules/config.json, which is then used to build the app afterwards.

My test repo is located here for more info.

Building my own addon inside hassio fails on network access

When building my own addon inside hassio any RUN command in the Dockerfile which tries to get network access fails. I can build my addon outside hassio and either with portainer or dockerhub have hassio load and run it without problems.

We have a discussion on the problem here
https://community.home-assistant.io/t/errors-when-buliding-a-new-addon/198841/11

Home Assistant Community
I tried to do a curl that failed. So I am thinking that your first hunch was correct and there is simply no network where the images are built. I found a issue on github where @frenck mentions a docker image for building images under different architectures. So my thinking is as yours, that they are building the images outside of hassio. I think I will create an issue on github and link to this thread

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.