⬆️ Upgrades add-on base image to 12.0.0 (#264)

* ⬆️ Upgrades add-on base image to 12.0.0

* Shellcheck actually caught a bug! :D

* Init true is the default
This commit is contained in:
Franck Nijhof 2022-06-11 13:17:26 +02:00 committed by GitHub
parent f0ea3acca7
commit da9bd0032e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 92 additions and 60 deletions

View file

@ -1,4 +1,4 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:11.1.0
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:12.0.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
@ -12,20 +12,20 @@ COPY requirements.txt /tmp/
ARG BUILD_ARCH=amd64
RUN \
apk add --no-cache --virtual .build-dependencies \
automake=1.16.4-r1 \
automake=1.16.5-r0 \
build-base=0.5-r2 \
linux-headers=5.10.41-r0 \
python3-dev=3.9.7-r4 \
linux-headers=5.16.7-r1 \
python3-dev=3.10.4-r0 \
\
&& apk add --no-cache \
nginx=1.20.2-r0 \
py3-pip=20.3.4-r1 \
python3=3.9.7-r4 \
nginx=1.22.0-r0 \
py3-pip=22.1.1-r0 \
python3=3.10.4-r0 \
\
&& pip3 install \
--no-cache-dir \
--prefer-binary \
--find-links "https://wheels.home-assistant.io/alpine-3.15/${BUILD_ARCH}/" \
--find-links "https://wheels.home-assistant.io/alpine-3.16/${BUILD_ARCH}/" \
-r /tmp/requirements.txt \
\
&& find /usr/local \
@ -39,6 +39,11 @@ RUN \
# Copy root filesystem
COPY rootfs /
# This add-on runs on the host pid namespace, making it impossible
# to use S6-Overlay. Therefore the init system is disabled at this point.
ENTRYPOINT []
CMD ["/run.sh"]
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE

View file

@ -1,10 +1,10 @@
---
build_from:
aarch64: ghcr.io/hassio-addons/base/aarch64:11.1.0
amd64: ghcr.io/hassio-addons/base/amd64:11.1.0
armhf: ghcr.io/hassio-addons/base/armhf:11.1.0
armv7: ghcr.io/hassio-addons/base/armv7:11.1.0
i386: ghcr.io/hassio-addons/base/i386:11.1.0
aarch64: ghcr.io/hassio-addons/base/aarch64:12.0.0
amd64: ghcr.io/hassio-addons/base/amd64:12.0.0
armhf: ghcr.io/hassio-addons/base/armhf:12.0.0
armv7: ghcr.io/hassio-addons/base/armv7:12.0.0
i386: ghcr.io/hassio-addons/base/i386:12.0.0
codenotary:
base_image: codenotary@frenck.dev
signer: codenotary@frenck.dev

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
# ==============================================================================
# Home Assistant Community Add-on: Glances
# This file turns s6-nuke into a NOOP to prevent total termination
# of the host system since the add-on runs in the same PID namespace.
# ==============================================================================
echo "S6-NUKE: NOOP"
exit 0

View file

@ -0,0 +1,37 @@
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Base Images
# Displays a simple add-on banner on startup
# ==============================================================================
if bashio::supervisor.ping; then
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue " Add-on: $(bashio::addon.name)"
bashio::log.blue " $(bashio::addon.description)"
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue " Add-on version: $(bashio::addon.version)"
if bashio::var.true "$(bashio::addon.update_available)"; then
bashio::log.magenta ' There is an update available for this add-on!'
bashio::log.magenta \
" Latest add-on version: $(bashio::addon.version_latest)"
bashio::log.magenta ' Please consider upgrading as soon as possible.'
else
bashio::log.green ' You are running the latest version of this add-on.'
fi
bashio::log.blue " System: $(bashio::info.operating_system)" \
" ($(bashio::info.arch) / $(bashio::info.machine))"
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue \
' Please, share the above information when looking for help'
bashio::log.blue \
' or support in, e.g., GitHub, forums or the Discord chat.'
bashio::log.blue \
'-----------------------------------------------------------'
fi

2
glances/rootfs/etc/cont-init.d/glances.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Configures Glances

2
glances/rootfs/etc/cont-init.d/nginx.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: SSH & Web Terminal
# Configures NGINX for use with ttyd

View file

@ -1,9 +0,0 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Take down the S6 supervision tree when Glances fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

2
glances/rootfs/etc/services.d/glances/run Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Runs Glances

View file

@ -1,9 +0,0 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Take down the S6 supervision tree when Glances fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

16
glances/rootfs/etc/services.d/influxdb/run Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Runs Glances InfluxDB Export
@ -6,7 +6,7 @@
declare -a options
if bashio::config.false 'influxdb.enabled'; then
exec sleep 86400
bashio::exit.ok
fi
options+=(-C /etc/glances.conf)
@ -23,9 +23,11 @@ if bashio::debug; then
options+=(--debug)
fi
# Interval
sleep "$(bashio::config 'influxdb.interval')"
# Run Glances
exec glances "${options[@]}"
while true
do
# Interval
sleep "$(bashio::config 'influxdb.interval')"
# Run Glances
glances "${options[@]}"
done

View file

@ -1,10 +0,0 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Take down the S6 supervision tree when the nginx daemon fails
# ==============================================================================
# Disabled to allow for some testing
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

2
glances/rootfs/etc/services.d/nginx/run Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/usr/bin/with-contenv bashio
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Runs the nginx daemon

24
glances/rootfs/run.sh Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bashio
# ==============================================================================
# Home Assistant Community Add-on: Glances
# Run the Glances add-on
# ==============================================================================
#
# WHAT IS THIS FILE?!
#
# The Glances add-on runs in the host PID namespace, therefore it cannot
# use the regular S6-Overlay; hence this add-on uses a "old school" script
# to run; with a couple of "hacks" to make it work.
# ==============================================================================
/etc/cont-init.d/banner.sh
/etc/cont-init.d/glances.sh
/etc/cont-init.d/nginx.sh
# Start NGiNX
/etc/services.d/nginx/run &
# InfluxDB export
/etc/services.d/influxdb/run &
# Start Glances
exec /etc/services.d/glances/run