Convert to integration/docker image
so: - removed addon & bashio dependencies - added the needed S6 dependency directly instead of via hassioaddons/base:8.0.6
This commit is contained in:
parent
544172d806
commit
4e2b713065
5 changed files with 95 additions and 11 deletions
|
|
@ -1,7 +1,55 @@
|
|||
ARG BUILD_FROM=hassioaddons/base:8.0.6
|
||||
FROM $BUILD_FROM
|
||||
ARG BUILD_FROM=alpine:3.12.1
|
||||
## hadolint ignore=DL3006
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
# Environment variables
|
||||
ENV \
|
||||
HOME="/root" \
|
||||
LANG="C.UTF-8" \
|
||||
PS1="$(whoami)@$(hostname):$(pwd)$ " \
|
||||
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
|
||||
S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
TERM="xterm-256color"
|
||||
|
||||
# Copy root filesystem
|
||||
COPY addon-base-rootfs /
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Install base system
|
||||
ARG BUILD_ARCH=armv7
|
||||
RUN \
|
||||
set -o pipefail \
|
||||
\
|
||||
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories \
|
||||
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
|
||||
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \
|
||||
\
|
||||
&& apk add --no-cache \
|
||||
libcrypto1.1=1.1.1g-r0 \
|
||||
libssl1.1=1.1.1g-r0 \
|
||||
musl-utils=1.1.24-r10 \
|
||||
musl=1.1.24-r10 \
|
||||
\
|
||||
&& apk add --no-cache \
|
||||
bash=5.0.17-r0 \
|
||||
curl=7.79.1-r1 \
|
||||
jq=1.6-r1 \
|
||||
tzdata=2022a-r0 \
|
||||
\
|
||||
&& S6_ARCH="${BUILD_ARCH}" \
|
||||
&& if [ "${BUILD_ARCH}" = "i386" ]; then S6_ARCH="x86"; fi \
|
||||
&& if [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; fi \
|
||||
\
|
||||
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-${S6_ARCH}.tar.gz" \
|
||||
| tar zxvf - -C / \
|
||||
\
|
||||
&& mkdir -p /etc/fix-attrs.d \
|
||||
&& mkdir -p /etc/services.d
|
||||
|
||||
# Entrypoint & CMD
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
|
@ -45,6 +93,9 @@ RUN npm install \
|
|||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
|
||||
# Set up empty /data/options.json
|
||||
RUN mkdir -p /data && echo "{}" > /data/options.json
|
||||
|
||||
# Build arguments
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_REF
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class PlejdDeviceCommunication extends EventEmitter {
|
|||
|
||||
await this.plejdBleHandler.init();
|
||||
} catch (err) {
|
||||
logger.error('Failed init() of BLE. Starting reconnect loop.');
|
||||
logger.error('Failed init() of BLE. Starting reconnect loop.', err);
|
||||
await this.plejdBleHandler.startReconnectPeriodicallyLoop();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
plejd/addon-base-rootfs/usr/bin/service
Executable file
33
plejd/addon-base-rootfs/usr/bin/service
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Base Images
|
||||
# This script patches all service commands into the appropriate s6- commands
|
||||
# Why not systemd? Docker said no, so did we ;)
|
||||
# ==============================================================================
|
||||
|
||||
start() {
|
||||
s6-svc -wU -u -T2500 "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
stop() {
|
||||
s6-svc -wD -d -T2500 "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
status() {
|
||||
s6-svstat "/var/run/s6/services/${service}"
|
||||
}
|
||||
|
||||
service="$1"
|
||||
command="$2"
|
||||
|
||||
if [[ ! -d "/var/run/s6/services/${service}" ]] ; then
|
||||
echo "s6 service not found for ${service}, exiting..."
|
||||
exit
|
||||
fi;
|
||||
|
||||
${command} "${service}"
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Plejd
|
||||
# Runs the Plejd service
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info 'Starting the Plejd service...'
|
||||
echo 'Starting the Plejd service...'
|
||||
|
||||
# Change working directory
|
||||
cd /plejd || bashio::exit.nok 'Unable to change working directory'
|
||||
cd /plejd || (>&2 echo 'Unable to change working directory'; exit $ERRCODE)
|
||||
|
||||
# Run the Plejd service
|
||||
bashio::log.info 'Verified permissions on startup script'
|
||||
echo 'Verifying permissions on startup script'
|
||||
chmod +x /usr/bin/plejd.sh
|
||||
|
||||
bashio::log.info 'Executing startup script'
|
||||
echo 'Executing startup script'
|
||||
exec /usr/bin/plejd.sh
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
#!/bin/bash
|
||||
|
||||
bashio::log.info 'Running add-on'
|
||||
echo 'Running add-on'
|
||||
exec node /plejd/main.js
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue