diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index faaea58..bbe864d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ variables: ADDON_ARMV7: "false" - ADDON_AARCH64_BASE: "hassioaddons/base-aarch64:2.3.2" - ADDON_AMD64_BASE: "hassioaddons/base-amd64:2.3.2" - ADDON_ARMHF_BASE: "hassioaddons/base-armhf:2.3.2" - ADDON_I386_BASE: "hassioaddons/base-i386:2.3.2" + ADDON_AARCH64_BASE: "hassioaddons/base-aarch64:3.0.0" + ADDON_AMD64_BASE: "hassioaddons/base-amd64:3.0.0" + ADDON_ARMHF_BASE: "hassioaddons/base-armhf:3.0.0" + ADDON_I386_BASE: "hassioaddons/base-i386:3.0.0" diff --git a/home-panel/Dockerfile b/home-panel/Dockerfile index 10994b8..9179933 100644 --- a/home-panel/Dockerfile +++ b/home-panel/Dockerfile @@ -1,32 +1,32 @@ -ARG BUILD_FROM=hassioaddons/base:2.3.2 +ARG BUILD_FROM=hassioaddons/base:3.0.0 # hadolint ignore=DL3006 FROM ${BUILD_FROM} # Install packages # hadolint ignore=DL3003 RUN \ - apk add --no-cache --virtual .build-dependencies \ - yarn=1.7.0-r0 \ - git=2.18.1-r0 \ - \ - && apk add --no-cache \ - nodejs-current=9.11.1-r2 \ - nginx=1.14.2-r0 \ - \ - && git clone --branch "v0.5.0" --depth=1 \ - "https://github.com/timmo001/home-panel-api.git" /opt/api \ - \ - && curl -J -L -o /tmp/panel.zip \ - "https://github.com/timmo001/home-panel/releases/download/v0.7.0/home-panel-built.zip" \ - && unzip -d /tmp /tmp/panel.zip \ - && mv /tmp/build /opt/panel \ - \ - && cd /opt/api \ - && yarn install \ - \ - && yarn cache clean \ - && apk del --purge .build-dependencies \ - && rm -fr /tmp/* + apk add --no-cache --virtual .build-dependencies \ + yarn=1.12.3-r0 \ + git=2.20.1-r0 \ + \ + && apk add --no-cache \ + nginx=1.14.2-r0 \ + nodejs-current=11.3.0-r0 \ + \ + && git clone --branch "v0.5.0" --depth=1 \ + "https://github.com/timmo001/home-panel-api.git" /opt/api \ + \ + && curl -J -L -o /tmp/panel.zip \ + "https://github.com/timmo001/home-panel/releases/download/v0.7.0/home-panel-built.zip" \ + && unzip -d /tmp /tmp/panel.zip \ + && mv /tmp/build /opt/panel \ + \ + && cd /opt/api \ + && yarn install \ + \ + && yarn cache clean \ + && apk del --purge .build-dependencies \ + && rm -fr /tmp/* # Copy root filesystem COPY rootfs / diff --git a/home-panel/build.json b/home-panel/build.json index 793882c..c45bff1 100644 --- a/home-panel/build.json +++ b/home-panel/build.json @@ -1,10 +1,10 @@ { "args": {}, "build_from": { - "aarch64": "hassioaddons/base-aarch64:2.3.2", - "amd64": "hassioaddons/base-amd64:2.3.2", - "armhf": "hassioaddons/base-armhf:2.3.2", - "i386": "hassioaddons/base-i386:2.3.2" + "aarch64": "hassioaddons/base-aarch64:3.0.0", + "amd64": "hassioaddons/base-amd64:3.0.0", + "armhf": "hassioaddons/base-armhf:3.0.0", + "i386": "hassioaddons/base-i386:3.0.0" }, "squash": false } diff --git a/home-panel/rootfs/etc/cont-init.d/10-requirements.sh b/home-panel/rootfs/etc/cont-init.d/10-requirements.sh index 036bb93..0a18665 100644 --- a/home-panel/rootfs/etc/cont-init.d/10-requirements.sh +++ b/home-panel/rootfs/etc/cont-init.d/10-requirements.sh @@ -1,30 +1,27 @@ -#!/usr/bin/with-contenv bash +#!/usr/bin/with-contenv bashio # ============================================================================== # Community Hass.io Add-ons: Home Panel # This checks if all user configuration requirements are met # ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh - # Check SSL requirements, if enabled -if hass.config.true 'ssl'; then - if ! hass.config.has_value 'certfile'; then - hass.die 'SSL is enabled, but no certfile was specified' +if bashio::config.true 'ssl'; then + if ! bashio::config.has_value 'certfile'; then + bashio::exit.nok 'SSL is enabled, but no certfile was specified' fi - if ! hass.config.has_value 'keyfile'; then - hass.die 'SSL is enabled, but no keyfile was specified' + if ! bashio::config.has_value 'keyfile'; then + bashio::exit.nok 'SSL is enabled, but no keyfile was specified' fi - if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then - hass.die 'The configured certfile is not found' + if ! bashio::fs.file_exists "/ssl/$(bashio::config 'certfile')"; then + bashio::exit.nok 'The configured certfile is not found' fi - if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then - hass.die 'The configured keyfile is not found' + if ! bashio::fs.file_exists "/ssl/$(bashio::config 'keyfile')"; then + bashio::exit.nok 'The configured keyfile is not found' fi fi -if ! hass.config.has_value 'config_file'; then - hass.die 'No config file was specified' +if ! bashio::config.has_value 'config_file'; then + bashio::exit.nok 'No config file was specified' fi diff --git a/home-panel/rootfs/etc/cont-init.d/20-config.sh b/home-panel/rootfs/etc/cont-init.d/20-config.sh index 12422f7..ec5bfcd 100644 --- a/home-panel/rootfs/etc/cont-init.d/20-config.sh +++ b/home-panel/rootfs/etc/cont-init.d/20-config.sh @@ -1,17 +1,14 @@ -#!/usr/bin/with-contenv bash +#!/usr/bin/with-contenv bashio # ============================================================================== # Community Hass.io Add-ons: Home Panel # This copies the configs to their respective locations # ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh - declare config_file -config_file="/config/$(hass.config.get 'config_file')" +config_file="/config/$(bashio::config 'config_file')" -if ! hass.file_exists "${config_file}"; then - hass.log.info "Config file does not exist. Creating.." +if ! bashio::fs.file_exists "${config_file}"; then + bashio::log.info "Config file does not exist. Creating.." cp /etc/home-panel/home-panel-config.default.json "${config_file}" - hass.log.info "Created. You should now edit this file at '${config_file}'" + bashio::log.info "Created. You should now edit this file at '${config_file}'" fi diff --git a/home-panel/rootfs/etc/cont-init.d/40-nginx.sh b/home-panel/rootfs/etc/cont-init.d/40-nginx.sh index 75b855b..2e727d2 100644 --- a/home-panel/rootfs/etc/cont-init.d/40-nginx.sh +++ b/home-panel/rootfs/etc/cont-init.d/40-nginx.sh @@ -1,18 +1,15 @@ -#!/usr/bin/with-contenv bash +#!/usr/bin/with-contenv bashio # ============================================================================== # Community Hass.io Add-ons: Home Panel # Configures NGINX for use with Home Panel # ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh - declare certfile declare keyfile # Enable SSL -if hass.config.true 'ssl'; then - certfile=$(hass.config.get 'certfile') - keyfile=$(hass.config.get 'keyfile') +if bashio::config.true 'ssl'; then + certfile=$(bashio::config 'certfile') + keyfile=$(bashio::config 'keyfile') sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx-ssl.conf sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx-ssl.conf diff --git a/home-panel/rootfs/etc/services.d/api/run b/home-panel/rootfs/etc/services.d/api/run index aa10423..ca0bba6 100644 --- a/home-panel/rootfs/etc/services.d/api/run +++ b/home-panel/rootfs/etc/services.d/api/run @@ -1,23 +1,20 @@ -#!/usr/bin/with-contenv bash +#!/usr/bin/with-contenv bashio # ============================================================================== # Community Hass.io Add-ons: Home Panel # Starts server to serve the API # ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh - -hass.log.info "Run API.." +bashio::log.info "Run API.." cd /opt/api \ - || hass.die "Could not change into API directory" + || bashio::exit.nok "Could not change into API directory" -LOG_LEVEL=$(hass.config.get 'log_level') +LOG_LEVEL=$(bashio::config 'log_level') DB_PATH=/config/home-panel.db -CONFIG_PATH=/config/$(hass.config.get 'config_file') +CONFIG_PATH=/config/$(bashio::config 'config_file') -if hass.config.true 'ssl'; then - SSL_PATH_CERT="/ssl/$(hass.config.get 'certfile')" - SSL_PATH_KEY="/ssl/$(hass.config.get 'keyfile')" +if bashio::config.true 'ssl'; then + SSL_PATH_CERT="/ssl/$(bashio::config 'certfile')" + SSL_PATH_KEY="/ssl/$(bashio::config 'keyfile')" fi export LOG_LEVEL diff --git a/home-panel/rootfs/etc/services.d/nginx/run b/home-panel/rootfs/etc/services.d/nginx/run index 410ac54..005946e 100644 --- a/home-panel/rootfs/etc/services.d/nginx/run +++ b/home-panel/rootfs/etc/services.d/nginx/run @@ -1,13 +1,11 @@ -#!/bin/bash +#!/usr/bin/with-contenv bashio # ============================================================================== # Community Hass.io Add-ons: Home Panel # Runs the NGINX daemon # ============================================================================== -# shellcheck disable=SC1091 -source /usr/lib/hassio-addons/base.sh +bashio::log.info "Starting NGINX..." -hass.log.info "Starting NGINX..." -if hass.config.true 'ssl'; then +if bashio::config.true 'ssl'; then options='/etc/nginx/nginx-ssl.conf' else options='/etc/nginx/nginx.conf'