Base Image: S6 overlay & jemalloc update (#72425)

* Update base image with new s6-Overlay & jemalloc

* add build version

* Update finish
This commit is contained in:
Pascal Vizeli 2022-05-24 15:51:06 +02:00 committed by GitHub
parent 23bd64b7a2
commit 6368df5e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 75 additions and 43 deletions

View File

@ -1,11 +1,11 @@
image: homeassistant/{arch}-homeassistant image: homeassistant/{arch}-homeassistant
shadow_repository: ghcr.io/home-assistant shadow_repository: ghcr.io/home-assistant
build_from: build_from:
aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2022.02.0 aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2022.05.0
armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2022.02.0 armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2022.05.0
armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.02.0 armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.05.0
amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.02.0 amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.05.0
i386: ghcr.io/home-assistant/i386-homeassistant-base:2022.02.0 i386: ghcr.io/home-assistant/i386-homeassistant-base:2022.05.0
codenotary: codenotary:
signer: notary@home-assistant.io signer: notary@home-assistant.io
base_image: notary@home-assistant.io base_image: notary@home-assistant.io

42
rootfs/etc/services.d/home-assistant/finish Normal file → Executable file
View File

@ -1,24 +1,30 @@
#!/usr/bin/execlineb -S1 #!/usr/bin/env bashio
# ============================================================================== # ==============================================================================
# Take down the S6 supervision tree when Home Assistant fails # Take down the S6 supervision tree when Home Assistant fails
# ============================================================================== # ==============================================================================
define HA_RESTART_EXIT_CODE 100 declare RESTART_EXIT_CODE 100
define SIGNAL_EXIT_CODE 256 declare SIGNAL_EXIT_CODE 256
define SIGTERM 15 declare SIGTERM 15
declare APP_EXIT_CODE=${1}
declare SYS_EXIT_CODE=${2+x}
declare NEW_EXIT_CODE=
foreground { s6-echo "[finish] process exit code ${1}" } bashio::log.info "Home Assistant Core finish process exit code ${1}"
if { s6-test ${1} -ne ${HA_RESTART_EXIT_CODE} } if [[ ${APP_EXIT_CODE} -eq ${RESTART_EXIT_CODE} ]]; then
ifelse { s6-test ${1} -eq ${SIGNAL_EXIT_CODE} } { exit 0
# Process terminated by a signal elif [[ ${APP_EXIT_CODE} -eq ${SIGNAL_EXIT_CODE} ]]; then
define signal ${2} bashio::log.info "Home Assistant Core finish process received signal ${APP_EXIT_CODE}"
foreground { s6-echo "[finish] process received signal ${signal}" }
backtick -n new_exit_code { s6-expr 128 + ${signal} }
importas -ui new_exit_code new_exit_code
foreground { redirfd -w 1 /var/run/s6/env-stage3/S6_STAGE2_EXITED s6-echo -n -- ${new_exit_code} }
if { s6-test ${signal} -ne ${SIGTERM} }
s6-svscanctl -t /var/run/s6/services
}
foreground { redirfd -w 1 /var/run/s6/env-stage3/S6_STAGE2_EXITED s6-echo -n -- ${1} } NEW_EXIT_CODE=$((128 + SYS_EXIT_CODE))
s6-svscanctl -t /var/run/s6/services echo ${NEW_EXIT_CODE} > /run/s6-linux-init-container-results/exitcode
if [[ ${NEW_EXIT_CODE} -eq ${SIGTERM} ]]; then
/run/s6/basedir/bin/halt
fi
else
bashio::log.info "Home Assistant Core service shutdown"
echo ${APP_EXIT_CODE} > /run/s6-linux-init-container-results/exitcode
/run/s6/basedir/bin/halt
fi

0
rootfs/etc/services.d/home-assistant/run Normal file → Executable file
View File

View File

@ -1,23 +1,49 @@
#!/bin/execlineb -S0 #!/usr/bin/env bashio
## # This is the first program launched at container start.
## load default PATH (the same that Docker includes if not provided) if it doesn't exist, # We don't know where our binaries are and we cannot guarantee
## then go ahead with stage1. # that the default PATH can access them.
## this was motivated due to this issue: # So this script needs to be entirely self-contained until it has
## - https://github.com/just-containers/s6-overlay/issues/108 # at least /command, /usr/bin and /bin in its PATH.
##
/bin/importas -D /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH PATH addpath () {
export PATH ${PATH} x="$1"
IFS=:
## set -- $PATH
## Skip further init if the user has a given CMD. IFS=
## This is to prevent Home Assistant from starting twice if the user while test "$#" -gt 0 ; do
## decided to override/start via the CMD. if test "$1" = "$x" ; then
## return
fi
ifelse { s6-test $# -ne 0 } shift
{ done
$@ PATH="${x}:$PATH"
} }
/etc/s6/init/init-stage1 $@
if test -z "$PATH" ; then
PATH=/bin
fi
addpath /bin
addpath /usr/bin
addpath /command
export PATH
# Now we're good: s6-overlay-suexec is accessible via PATH, as are
# all our binaries.
# Skip further init if the user has a given CMD.
# This is to prevent Home Assistant from starting twice if the user
# decided to override/start via the CMD.
if test $# -ne 0 ; then
exec "$@"
fi
# Run preinit as root, then run stage0 as the container's user (can be
# root, can be a normal user).
exec s6-overlay-suexec \
' /package/admin/s6-overlay-@VERSION@/libexec/preinit' \
'' \
/package/admin/s6-overlay-@VERSION@/libexec/stage0 \
"$@"