mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-21 14:59:14 +02:00
adding options for better customization of add on
This commit is contained in:
@@ -31,17 +31,37 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
|||||||
# 3 Install apps #
|
# 3 Install apps #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
# Add rootfs
|
||||||
|
COPY rootfs/ /
|
||||||
|
|
||||||
|
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) >/dev/null; 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) >/dev/null; fi \
|
||||||
|
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \
|
||||||
|
&& mkdir -p /etc/cont-init.d \
|
||||||
|
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||||
|
&& chmod -R 755 /etc/cont-init.d || printf '%s\n' "${MODULES}" >/MODULESFILE
|
||||||
|
|
||||||
|
# Manual apps
|
||||||
|
ENV PACKAGES=""
|
||||||
|
|
||||||
|
# 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) >/dev/null; 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) >/dev/null; fi \
|
||||||
|
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||||
|
&& chmod 777 /automatic_packages.sh \
|
||||||
|
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||||
|
&& rm /automatic_packages.sh || (printf '%s\n' "${PACKAGES:-}" > /ENVFILE; \
|
||||||
|
if [ -f /etc/s6-overlay/s6-rc.d/init-migrations/run ]; then chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh && sed -i "1a /./etc/cont-init.d/00-aaa_dockerfile_backup.sh" /etc/s6-overlay/s6-rc.d/init-migrations/run;fi)
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 22 3000
|
EXPOSE 22 3000
|
||||||
|
|
||||||
################
|
################
|
||||||
# 4 Entrypoint #
|
# 4 Entrypoint #
|
||||||
################
|
################
|
||||||
|
|
||||||
#RUN chmod 777 /entrypoint.sh
|
RUN chmod 777 /entrypoint.sh
|
||||||
#WORKDIR /
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
|
||||||
#CMD [ "/entrypoint.sh" ]
|
|
||||||
#SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
||||||
|
|
||||||
############
|
############
|
||||||
# 5 Labels #
|
# 5 Labels #
|
||||||
@@ -71,4 +91,4 @@ LABEL \
|
|||||||
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
||||||
org.opencontainers.image.created=${BUILD_DATE} \
|
org.opencontainers.image.created=${BUILD_DATE} \
|
||||||
org.opencontainers.image.revision=${BUILD_REF} \
|
org.opencontainers.image.revision=${BUILD_REF} \
|
||||||
org.opencontainers.image.version=${BUILD_VERSION}
|
org.opencontainers.image.version=${BUILD_VERSION}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
],
|
],
|
||||||
"codenotary": "alexandrep.github@gmail.com",
|
"codenotary": "alexandrep.github@gmail.com",
|
||||||
"description": "Gitea for Home Assistant",
|
"description": "Gitea for Home Assistant",
|
||||||
"image": "ghcr.io/alexbelgium/gitea-{arch}",
|
|
||||||
"init": false,
|
"init": false,
|
||||||
"map": [
|
"map": [
|
||||||
"share:rw",
|
"share:rw",
|
||||||
@@ -15,7 +14,10 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"certfile": "fullchain.pem",
|
"certfile": "fullchain.pem",
|
||||||
"keyfile": "privkey.pem",
|
"keyfile": "privkey.pem",
|
||||||
"ssl": false
|
"ssl": false,
|
||||||
|
"SITE_TITLE": "Gitea: Git with a cup of tea",
|
||||||
|
"SERVER_DOMAIN": "localhost",
|
||||||
|
"BASE_URL": "http://localhost:3000/"
|
||||||
},
|
},
|
||||||
"ports": {
|
"ports": {
|
||||||
"22/tcp": 2222,
|
"22/tcp": 2222,
|
||||||
@@ -23,15 +25,18 @@
|
|||||||
},
|
},
|
||||||
"ports_description": {
|
"ports_description": {
|
||||||
"22/tcp": "Ssh",
|
"22/tcp": "Ssh",
|
||||||
"3000/tcp": "Http web interface"
|
"3000/tcp": "Web interface"
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"certfile": "str",
|
"certfile": "str",
|
||||||
"keyfile": "str",
|
"keyfile": "str",
|
||||||
"ssl": "bool"
|
"ssl": "bool",
|
||||||
|
"SITE_TITLE": "str",
|
||||||
|
"SERVER_DOMAIN": "str",
|
||||||
|
"BASE_URL": "str"
|
||||||
},
|
},
|
||||||
"slug": "gitea",
|
"slug": "gitea",
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/gitea",
|
"url": "https://github.com/baldarn/hassio-addons/tree/master/gitea",
|
||||||
"version": "1.17.2",
|
"version": "1.17.2-1",
|
||||||
"webui": "[PROTO:ssl]://[HOST]:[PORT:3000]"
|
"webui": "[PROTO:ssl]://[HOST]:[PORT:3000]"
|
||||||
}
|
}
|
||||||
|
|||||||
27
gitea/rootfs/entrypoint.sh
Normal file
27
gitea/rootfs/entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Starting..."
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Backup Dockerfile Script #
|
||||||
|
############################
|
||||||
|
|
||||||
|
if [ -f /etc/cont-init.d/00-aaa_dockerfile_backup.sh ]; then
|
||||||
|
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||||
|
chmod +x /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||||
|
/./etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||||
|
rm /etc/cont-init.d/00-aaa_dockerfile_backup.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Starting scripts #
|
||||||
|
####################
|
||||||
|
|
||||||
|
for SCRIPTS in /etc/cont-init.d/*; do
|
||||||
|
[ -e "$SCRIPTS" ] || continue
|
||||||
|
echo "$SCRIPTS: executing"
|
||||||
|
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||||
|
chmod a+x "$SCRIPTS"
|
||||||
|
# Change shebang if no s6 supervision
|
||||||
|
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS"
|
||||||
|
/."$SCRIPTS" || echo "$SCRIPTS: exiting $?"
|
||||||
|
done
|
||||||
50
gitea/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh
Normal file
50
gitea/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If dockerfile failed install manually
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Automatic modules download #
|
||||||
|
##############################
|
||||||
|
if [ -e "/MODULESFILE" ]; then
|
||||||
|
MODULES=$(</MODULESFILE)
|
||||||
|
MODULES="${MODULES:-00-banner.sh}"
|
||||||
|
echo "Executing modules script : $MODULES"
|
||||||
|
|
||||||
|
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) >/dev/null; 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) >/dev/null; fi \
|
||||||
|
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \
|
||||||
|
&& mkdir -p /etc/cont-init.d \
|
||||||
|
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||||
|
&& chmod -R 755 /etc/cont-init.d
|
||||||
|
fi
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Automatic installer #
|
||||||
|
#######################
|
||||||
|
if [ -e "/ENVFILE" ]; then
|
||||||
|
PACKAGES=$(</ENVFILE)
|
||||||
|
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||||
|
|
||||||
|
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) >/dev/null; 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) >/dev/null; fi \
|
||||||
|
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||||
|
&& chmod 777 /automatic_packages.sh \
|
||||||
|
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||||
|
&& rm /automatic_packages.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/MODULESFILE" ] && [ ! -f /entrypoint.sh ]; then
|
||||||
|
for scripts in $MODULES; do
|
||||||
|
echo "$scripts : executing"
|
||||||
|
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/"$scripts"
|
||||||
|
chmod a+x /etc/cont-init.d/"$scripts"
|
||||||
|
/./etc/cont-init.d/"$scripts" || echo "/etc/cont-init.d/$scripts: exiting $?"
|
||||||
|
rm /etc/cont-init.d/"$scripts"
|
||||||
|
done | tac
|
||||||
|
fi
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Correct permissions #
|
||||||
|
#######################
|
||||||
|
[ -d /etc/services.d ] && chmod -R 777 /etc/services.d
|
||||||
|
[ -d /etc/cont-init.d ] && chmod -R 777 /etc/cont-init.d
|
||||||
16
gitea/rootfs/etc/cont-init.d/99-run.sh
Normal file
16
gitea/rootfs/etc/cont-init.d/99-run.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
SITE_TITLE=$(bashio::config 'SITE_TITLE')
|
||||||
|
SERVER_DOMAIN=$(bashio::config 'SERVER_DOMAIN')
|
||||||
|
BASE_URL=$(bashio::config 'BASE_URL')
|
||||||
|
|
||||||
|
echo "site tile $SITE_TITLE"
|
||||||
|
echo "server domain $SERVER_DOMAIN"
|
||||||
|
echo "base url $BASE_URL"
|
||||||
|
|
||||||
|
# sed "s/^APP.*/APP = $SITE_TITLE/" /data/gitea/conf/app.ini
|
||||||
|
# sed "s/^DOMAIN.*/DOMAIN = $SERVER_DOMAIN/" /data/gitea/conf/app.ini
|
||||||
|
# sed "s/^ROOT_URL.*/ROOT_URL = $BASE_URL/" /data/gitea/conf/app.ini
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user