⬆️ Upgrade to the 3.0.0 base and migrate to bashio

This commit is contained in:
Timmo 2019-03-19 19:41:50 +00:00
parent a53eaef465
commit a6dfb6b231
8 changed files with 63 additions and 77 deletions

View file

@ -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"

View file

@ -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 /

View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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'