#============================# # ALEXBELGIUM'S DOCKERFILE # #============================# # _.------. # _.-` ('>.-`"""-. # '.--'` _'` _ .--.) # -' '-.-';` ` # ' - _.' ``'--. # '---` .-'""` # /` #=== Home Assistant Addon ===# ################# # 1 Build Image # ################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} ################## # 2 Modify Image # ################## # Set S6 wait time ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 USER root # GENERAL MODIFICATIONS ####################### # Image specific modifications # hadolint ignore=DL4006 RUN \ # Set download folder to /share sed -i 's|/downloads/|/share/qBittorrent/|g' /defaults/qBittorrent.conf \ \ # Remove fixed folders, allows connection to webUI && sed '11,13d' /defaults/qBittorrent.conf \ && echo 'WebUI\HostHeaderValidation=false' >> /defaults/qBittorrent.conf \ && echo 'WebUI\LocalHostAuth=false' >> /defaults/qBittorrent.conf \ \ # Add vuetorrent && curl -f -s -S -O -J -L "$(curl -f -s https://api.github.com/repos/WDaan/VueTorrent/releases | grep -o "http.*vuetorrent.zip" | head -1)" >/dev/null \ && unzip -o vuetorrent.zip -d / >/dev/null \ && rm vuetorrent.zip >/dev/null # ADD QBIT_MANAGE ################# ENV QBM_DOCKER True ENV QBT_SKIP_QB_VERSION_CHECK True ENV PYTHONUNBUFFERED=1 # halodint disable=DL3019,SC3010 RUN \ # Install qbit_manage mkdir -p /qbit_manage && \ curl -o /tmp/qbit_manage.tar.gz -L "https://github.com/StuffAnThings/qbit_manage/archive/master.tar.gz" && \ tar xf /tmp/qbit_manage.tar.gz -C /qbit_manage --strip-components=1 && \ \ # Install dependencies ## Allow python specific arch BUILD_ARCH=$(uname -m) && \ echo "${BUILD_ARCH}" && \ BUILD_ARCH=${BUILD_ARCH:-x86} && \ if [[ "${BUILD_ARCH}" != *amd64* ]]; then apk add python3-dev; else apk add python3; fi && \ ln -sf python3 /usr/bin/python && \ python3 -m ensurepip && \ ## Install other pip3 install --no-cache --upgrade pip setuptools && \ apk add gcc musl-dev && \ pip3 install --no-cache-dir --upgrade --requirement /qbit_manage/requirements.txt --ignore-installed ################## # 3 Install apps # ################## # Copy local files COPY rootfs/ / # Modules ARG MODULES="00-banner.sh 01-custom_script.sh 00-local_mounts.sh 00-smb_mounts.sh 90-dns_set.sh" # Automatic modules download ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh" RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh #RUN if [ -f /etc/s6-overlay/s6-rc.d/init-adduser ]; then for SCRIPTS in /etc/cont-init.d/*; do [ -e "$SCRIPTS" ] || continue \ # && mkdir -p /abscripts && sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS" \ # && SCRIPTSNAME="$(basename "$SCRIPTS")" && mkdir /etc/s6-overlay/s6-rc.d/"$SCRIPTSNAME" && mv "$SCRIPTS" /etc/s6-overlay/s6-rc.d/"$SCRIPTSNAME"/run \ # && echo "oneshot" > /etc/s6-overlay/s6-rc.d/"$SCRIPTSNAME"/type && echo "/etc/s6-overlay/s6-rc.d/$SCRIPTSNAME/run" > /etc/s6-overlay/s6-rc.d/"$SCRIPTSNAME"/up \ # && chmod a+x /etc/s6-overlay/s6-rc.d/$SCRIPTSNAME/* ; done; fi # Manual apps ARG PACKAGES="dos2unix" # Automatic apps & bashio ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh" RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.sh # Switch scripts from s6 v2 to v3 #RUN if [ -f /etc/s6-overlay/s6-rc.d/init-custom-file/run ]; then mkdir "/custom-cont-init.d" && for SCRIPTS in /etc/cont-init.d/*; do [ -e "$SCRIPTS" ] || continue \ # && mv "$SCRIPTS" /custom-cont-init.d && chmod a+x /custom-cont-init.d/*; done; fi ################ # 4 Entrypoint # ################ # Add entrypoint ENV S6_STAGE2_HOOK=/ha_entrypoint.sh ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint.sh" "/ha_entrypoint.sh" # Entrypoint modifications ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh" RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh ############ # 5 Labels # ############ ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION ARG BUILD_NAME ARG BUILD_REF ARG BUILD_REPOSITORY ARG BUILD_VERSION LABEL \ io.hass.name="${BUILD_NAME}" \ io.hass.description="${BUILD_DESCRIPTION}" \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ maintainer="alexbelgium (https://github.com/alexbelgium)" \ org.opencontainers.image.title="${BUILD_NAME}" \ org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ org.opencontainers.image.vendor="Home Assistant Add-ons" \ org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.url="https://github.com/alexbelgium" \ org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REF} \ org.opencontainers.image.version=${BUILD_VERSION} ################# # 6 Healthcheck # #################