Add independent Home Assistant addon
This commit is contained in:
14
addon/Dockerfile
Normal file
14
addon/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM python:3.13-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY pyproject.toml README.md ./
|
||||
COPY app ./app
|
||||
RUN python -m pip install --no-cache-dir .
|
||||
|
||||
COPY addon/run.sh /run.sh
|
||||
RUN chmod 0755 /run.sh \
|
||||
&& useradd --create-home --uid 10001 sillyhome
|
||||
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
|
||||
29
addon/config.yaml
Normal file
29
addon/config.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
name: SillyHome Future
|
||||
version: "2.0.0-alpha.2"
|
||||
slug: sillyhome_future
|
||||
description: Event-first SillyHome v2 test controller
|
||||
url: http://192.168.6.31:3000/Otto/sillyhome-future
|
||||
arch:
|
||||
- amd64
|
||||
startup: application
|
||||
boot: manual
|
||||
watchdog: http://[HOST]:[PORT:8099]/health
|
||||
init: false
|
||||
ingress: true
|
||||
ingress_port: 8099
|
||||
panel_title: SillyHome Future
|
||||
panel_icon: mdi:home-lightning-bolt
|
||||
panel_admin: true
|
||||
homeassistant_api: true
|
||||
hassio_api: false
|
||||
auth_api: false
|
||||
map:
|
||||
- type: addon_config
|
||||
read_only: false
|
||||
options:
|
||||
store_path: /data/future_store
|
||||
log_level: info
|
||||
schema:
|
||||
store_path: str
|
||||
log_level: list(debug|info|warning|error)
|
||||
|
||||
31
addon/run.sh
Normal file
31
addon/run.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
STORE_PATH="/data/future_store"
|
||||
LOG_LEVEL="info"
|
||||
if [ -f /data/options.json ]; then
|
||||
eval "$(python - <<'PY'
|
||||
import json
|
||||
import shlex
|
||||
|
||||
with open("/data/options.json", encoding="utf-8") as stream:
|
||||
options = json.load(stream)
|
||||
for name, env_name in {
|
||||
"store_path": "STORE_PATH",
|
||||
"log_level": "LOG_LEVEL",
|
||||
}.items():
|
||||
if name in options:
|
||||
print(f"{env_name}={shlex.quote(str(options[name]))}")
|
||||
PY
|
||||
)"
|
||||
fi
|
||||
|
||||
export SILLYHOME_FUTURE_STORE="$STORE_PATH"
|
||||
mkdir -p "$SILLYHOME_FUTURE_STORE"
|
||||
chown -R sillyhome:sillyhome "$SILLYHOME_FUTURE_STORE"
|
||||
|
||||
exec su -s /bin/sh sillyhome -c \
|
||||
"uvicorn app.main:app --host 0.0.0.0 --port 8099 --log-level ${LOG_LEVEL}"
|
||||
|
||||
Reference in New Issue
Block a user