mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-08 08:35:57 +02:00
Merge pull request #477 from baldarn/master
adding more options for gitea (support requested)
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
## 1.17.2.1 (26-09-2022)
|
||||||
|
- fixed error with ssl
|
||||||
|
|
||||||
## 1.17.2 (07-09-2022)
|
## 1.17.2 (07-09-2022)
|
||||||
- Update to version 1.17.2 from go-gitea/gitea
|
- Update to version 1.17.2 from go-gitea/gitea
|
||||||
|
|
||||||
|
|||||||
@@ -26,22 +26,52 @@ FROM ${BUILD_FROM}
|
|||||||
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||||
S6_SERVICES_GRACETIME=0
|
S6_SERVICES_GRACETIME=0
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# 3 Install apps #
|
# 3 Install apps #
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
# Add rootfs
|
||||||
|
COPY rootfs/ /
|
||||||
|
|
||||||
|
# Corrects permissions for s6 v3
|
||||||
|
RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \
|
||||||
|
if [ -d /etc/services.d ]; then chmod -R 755 /etc/services.d; fi && \
|
||||||
|
if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
|
||||||
|
|
||||||
|
# Modules
|
||||||
|
ARG MODULES="00-banner.sh"
|
||||||
|
|
||||||
|
# Automatic modules download
|
||||||
|
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 +101,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}
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ This addon is based on the [docker image](https://hub.docker.com/r/gitea/gitea).
|
|||||||
```yaml
|
```yaml
|
||||||
certfile: fullchain.pem #ssl certificate, must be located in /ssl
|
certfile: fullchain.pem #ssl certificate, must be located in /ssl
|
||||||
keyfile: privkey.pem #sslkeyfile, must be located in /ssl
|
keyfile: privkey.pem #sslkeyfile, must be located in /ssl
|
||||||
|
ssl: should the app use https or not
|
||||||
|
APP_NAME: name of the app
|
||||||
|
DOMAIN: domain to be reached # default : homeassistant.local
|
||||||
|
ROOT_URL: customize root_url, should not be needed unless specific needs
|
||||||
```
|
```
|
||||||
|
|
||||||
Webui can be found at `<your-ip>:port`.
|
Webui can be found at `<your-ip>:port`.
|
||||||
|
|||||||
@@ -9,13 +9,15 @@
|
|||||||
"init": false,
|
"init": false,
|
||||||
"map": [
|
"map": [
|
||||||
"share:rw",
|
"share:rw",
|
||||||
"ssl:ro"
|
"ssl:rw"
|
||||||
],
|
],
|
||||||
"name": "Gitea",
|
"name": "Gitea",
|
||||||
"options": {
|
"options": {
|
||||||
"certfile": "fullchain.pem",
|
"certfile": "fullchain.pem",
|
||||||
"keyfile": "privkey.pem",
|
"keyfile": "privkey.pem",
|
||||||
"ssl": false
|
"ssl": false,
|
||||||
|
"APP_NAME": "Gitea for Homeassistant",
|
||||||
|
"DOMAIN": "homeassistant.local"
|
||||||
},
|
},
|
||||||
"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",
|
||||||
|
"APP_NAME": "str?",
|
||||||
|
"DOMAIN": "str",
|
||||||
|
"ROOT_URL": "str?"
|
||||||
},
|
},
|
||||||
"slug": "gitea",
|
"slug": "gitea",
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/gitea",
|
"url": "https://github.com/alexbelgium/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
|
||||||
65
gitea/rootfs/etc/cont-init.d/99-run.sh
Normal file
65
gitea/rootfs/etc/cont-init.d/99-run.sh
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
for file in /data/gitea/conf/app.ini /etc/templates/app.ini; do
|
||||||
|
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
##############
|
||||||
|
# ADAPT PORT #
|
||||||
|
##############
|
||||||
|
|
||||||
|
sed -i "/HTTP_PORT/d" "$file"
|
||||||
|
sed -i "/server/a HTTP_PORT=$(bashio::addon.port 3000)" "$file"
|
||||||
|
|
||||||
|
##############
|
||||||
|
# SSL CONFIG #
|
||||||
|
##############
|
||||||
|
|
||||||
|
# Clean values
|
||||||
|
sed -i "/PROTOCOL/d" "$file"
|
||||||
|
sed -i "/CERT_FILE/d" "$file"
|
||||||
|
sed -i "/KEY_FILE/d" "$file"
|
||||||
|
|
||||||
|
# Add ssl
|
||||||
|
bashio::config.require.ssl
|
||||||
|
if bashio::config.true 'ssl'; then
|
||||||
|
bashio::log.info "ssl is enabled"
|
||||||
|
sed -i "/server/a PROTOCOL=https" "$file"
|
||||||
|
sed -i "/server/a CERT_FILE=/ssl/$(bashio::config 'certfile')" "$file"
|
||||||
|
sed -i "/server/a KEY_FILE=/ssl/$(bashio::config 'keyfile')" "$file"
|
||||||
|
chmod 744 /ssl/*
|
||||||
|
else
|
||||||
|
sed -i "/server/a PROTOCOL=http" "$file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
####################
|
||||||
|
# ADAPT PARAMETERS #
|
||||||
|
####################
|
||||||
|
|
||||||
|
for param in APP_NAME DOMAIN ROOT_URL; do
|
||||||
|
# Remove parameter
|
||||||
|
sed -i "/$param/d" "$file"
|
||||||
|
|
||||||
|
# Define parameter
|
||||||
|
if bashio::config.has_value "$param"; then
|
||||||
|
echo "parameter set : $param=$(bashio::config '$param')"
|
||||||
|
sed -i "/server/a $param=$(bashio::config '$param')" "$file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Allow at setup
|
||||||
|
sed -i "1a $param = $(bashio::config '$param')" /etc/s6/gitea/setup
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
##############
|
||||||
|
# LAUNCH APP #
|
||||||
|
##############
|
||||||
|
|
||||||
|
bashio::log.info "Please wait while the app is loading !"
|
||||||
|
|
||||||
|
/./usr/bin/entrypoint
|
||||||
Reference in New Issue
Block a user