mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
New logic
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
- New standardized logic for Dockerfile build and packages installation
|
||||
- Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename
|
||||
- Add local drives mounts : used localdisks with the text "sda1, sdb1" according to your needs
|
||||
- Add ssl
|
||||
|
||||
@@ -1,30 +1,15 @@
|
||||
#################
|
||||
# 1 Build Image #
|
||||
#################
|
||||
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_UPSTREAM="2.1.2"
|
||||
FROM ${BUILD_FROM}
|
||||
ENV BASHIO_VERSION=0.14.3
|
||||
ENV PACKAGES="curl \
|
||||
jq \
|
||||
moreutils \
|
||||
samba \
|
||||
nginx"
|
||||
|
||||
# Add bashio
|
||||
RUN apk add --no-cache ${PACKAGES} \
|
||||
\
|
||||
&& 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 \
|
||||
&& rm -fr /tmp/bashio.tar.gz || true
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
##################
|
||||
|
||||
RUN \
|
||||
# Set config directory
|
||||
@@ -43,9 +28,42 @@ RUN \
|
||||
&& sed -i 's|bash|bashio|g' /etc/services.d/ubooquity/run \
|
||||
&& sed -i 's|{MAXMEM:-512}|(bashio::config "maxmem")|g' /etc/services.d/ubooquity/run
|
||||
|
||||
VOLUME [ "/data" ]
|
||||
##################
|
||||
# 3 Install apps #
|
||||
##################
|
||||
|
||||
# Add rootfs
|
||||
COPY rootfs/ /
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES="curl \
|
||||
jq \
|
||||
moreutils \
|
||||
samba \
|
||||
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
|
||||
|
||||
################
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
#RUN chmod 777 /entrypoint.sh
|
||||
#WORKDIR /
|
||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
||||
#CMD [ "/entrypoint.sh" ]
|
||||
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
############
|
||||
|
||||
### LABELS
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user