New logic

This commit is contained in:
Alexandre
2021-12-14 13:39:15 +01:00
parent 6df150b341
commit 90f333c40d
269 changed files with 6071 additions and 2163 deletions

View File

@@ -1,4 +1,8 @@
## 2.1.28 (14-12-2021)
- Update to latest version from anthonyraymond/joal
- New standardized logic for Dockerfile build and packages installation
## 2.1.27 (17-11-2021)
- Update to latest version from anthonyraymond/joal

View File

@@ -1,58 +1,60 @@
#################
# 1 Build Image #
#################
ARG BUILD_FROM
ARG BUILD_UPSTREAM="2.1.27"
ARG BUILD_UPSTREAM="2.1.28"
FROM anthonyraymond/joal:$BUILD_UPSTREAM
# Set shell
##################
# 2 Modify Image #
##################
#Install Joal
RUN \
if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \
curl -s -S -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz") >/dev/null &&\
mkdir -p /data/joal &&\
tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null &&\
chown -R $(id -u):$(id -g) /data/joal &&\
rm /data/joal/jack-of* || true
##################
# 3 Install apps #
##################
# Add rootfs
COPY rootfs/ /
# Manual apps
ENV PACKAGES="jq \
nginx"
# Automatic apps & bashio
RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \
if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \
chmod 777 /automatic_packages.sh && \
/automatic_packages.sh "${PACKAGES:-}" && \
rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG BUILD_VERSION
ARG BUILD_UPSTREAM="2.1.27"
ENV BASHIO_VERSION=0.14.3
ENV PACKAGES="wget \
jq \
nginx"
ARG BUILD_UPSTREAM="2.1.28"
RUN \
#Install bashio
apt-get clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${PACKAGES} \
\
##################
# Install bashio #
##################
&& curl -J -L -o /tmp/bashio.tar.gz \
"https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
&& mkdir /tmp/bashio \
&& tar zxvf \
/tmp/bashio.tar.gz \
--strip 1 -C /tmp/bashio \
\
&& mv /tmp/bashio/lib /usr/lib/bashio \
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio || true
################
# 4 Entrypoint #
################
RUN \
#Install Joal
wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$BUILD_UPSTREAM/joal.tar.gz" \
&& mkdir -p /data/joal \
&& tar zxvf /tmp/joal.tar.gz -C /data/joal \
&& rm /data/joal/jack-of* \
#Clean
&& rm -fr \
/tmp/* \
/var/{cache,log}/* \
/var/lib/apt/lists/*
VOLUME [ "/data" ]
# copy local files
COPY rootfs/ /
#WORKDIR /
RUN chmod 777 /entrypoint.sh
ENTRYPOINT [ "/usr/bin/env" ]
CMD [ "/entrypoint.sh" ]
### LABELS
############
# 5 Labels #
############
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION

View File

@@ -38,8 +38,8 @@
},
"slug": "joal",
"startup": "services",
"upstream": "2.1.27",
"upstream": "2.1.28",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "2.1.27",
"version": "2.1.28",
"webui": "http://[HOST]:[PORT:8081]/joal/ui?ui_credentials=%7B%22host%22%3A%22[HOST]%22%2C%22port%22%3A%22[PORT:8081]%22%2C%22pathPrefix%22%3A%22joal%22%2C%22secretToken%22%3A%22lrMY24Byhx%22%7D"
}

View File

@@ -2,34 +2,6 @@
echo "Starting..."
###################################
# Export all addon options as env #
###################################
# For all keys in options.json
JSONSOURCE="/data/options.json"
# Export keys as env variables
echo "All addon options were exported as variables"
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
for KEYS in ${arr[@]}; do
# export key
VALUE=$(jq .$KEYS ${JSONSOURCE})
export ${KEYS}=${VALUE//[\"\']/} &>/dev/null
done
################
# Set timezone #
################
if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then
if [ -f /usr/share/zoneinfo/$TZ ]; then
echo "Timezone set from $(cat /etc/timezone) to $TZ"
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone
else
echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)"
fi
fi
####################
# Starting scripts #
####################

View File

@@ -1,29 +1,18 @@
#!/bin/bash
# If dockerfile failed install manually
if [ ! -f "/usr/bin/bashio" ]; then
echo "Bashio does not exist, executing script"
if [ -e "/ENVFILE" ]; then
echo "Executing script"
PACKAGES=$(</ENVFILE)
(
################
# Install apps #
################
PACKAGES="${PACKAGES:="curl"}"
apt-get clean \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${PACKAGES} 2>/dev/null \
|| apk add --no-cache ${PACKAGES}
###################
# Install bashio #
##################
mkdir -p /tmp/bashio
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
tar -xzf - --strip 1 -C /tmp/bashio
mv /tmp/bashio/lib /usr/lib/bashio
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
rm -rf /tmp/bashio
#######################
# Automatic installer #
#######################
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi &&
if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi &&
curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh &&
chmod 777 /automatic_packages.sh &&
eval /./automatic_packages.sh "$PACKAGES" &&
rm /automatic_packages.sh
) >/dev/null
fi

View File

@@ -18,10 +18,8 @@ fi
if [ $VERBOSE = true ]; then
curl -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz")
#wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$UPSTREAM/joal.tar.gz"
else
curl -s -S -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz") >/dev/null
#wget -q -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$UPSTREAM/joal.tar.gz"
fi
mkdir -p /data/joal
tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null