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
shadow_repository: ghcr.io/home-assistant
build_from:
aarch64: ghcr.io/home-assistant/aarch64-homeassistant-base:2022.02.0
armhf: ghcr.io/home-assistant/armhf-homeassistant-base:2022.02.0
armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.02.0
amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.02.0
i386: ghcr.io/home-assistant/i386-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.05.0
armv7: ghcr.io/home-assistant/armv7-homeassistant-base:2022.05.0
amd64: ghcr.io/home-assistant/amd64-homeassistant-base:2022.05.0
i386: ghcr.io/home-assistant/i386-homeassistant-base:2022.05.0
codenotary:
signer: 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
# ==============================================================================
define HA_RESTART_EXIT_CODE 100
define SIGNAL_EXIT_CODE 256
define SIGTERM 15
declare RESTART_EXIT_CODE 100
declare SIGNAL_EXIT_CODE 256
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} }
ifelse { s6-test ${1} -eq ${SIGNAL_EXIT_CODE} } {
# Process terminated by a signal
define signal ${2}
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
}
if [[ ${APP_EXIT_CODE} -eq ${RESTART_EXIT_CODE} ]]; then
exit 0
elif [[ ${APP_EXIT_CODE} -eq ${SIGNAL_EXIT_CODE} ]]; then
bashio::log.info "Home Assistant Core finish process received signal ${APP_EXIT_CODE}"
foreground { redirfd -w 1 /var/run/s6/env-stage3/S6_STAGE2_EXITED s6-echo -n -- ${1} }
s6-svscanctl -t /var/run/s6/services
NEW_EXIT_CODE=$((128 + SYS_EXIT_CODE))
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
##
## load default PATH (the same that Docker includes if not provided) if it doesn't exist,
## then go ahead with stage1.
## this was motivated due to this issue:
## - https://github.com/just-containers/s6-overlay/issues/108
##
# This is the first program launched at container start.
# We don't know where our binaries are and we cannot guarantee
# that the default PATH can access them.
# So this script needs to be entirely self-contained until it has
# 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
export PATH ${PATH}
##
## 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.
##
ifelse { s6-test $# -ne 0 }
{
$@
addpath () {
x="$1"
IFS=:
set -- $PATH
IFS=
while test "$#" -gt 0 ; do
if test "$1" = "$x" ; then
return
fi
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 \
"$@"