initial build

This commit is contained in:
Alexandre
2022-01-12 17:08:37 +01:00
parent dc12f4b9ec
commit 703ce11309
11 changed files with 276 additions and 0 deletions

View File

@@ -0,0 +1 @@
- Initial build

View File

@@ -0,0 +1,76 @@
#==========================#
# ALEXBELGIUM'S DOCKERFILE #
#==========================#
#           _.------.
#       _.-`    ('>.-`"""-.
# '.--'`       _'`   _ .--.)
#    -'         '-.-';`   `
#    ' -      _.'  ``'--. 
#        '---`    .-'""`
#               /`
#################
# 1 Build Image #
#################
ARG BUILD_VERSION
FROM ${BUILD_FROM}
##################
# 2 Modify Image #
##################
##################
# 3 Install apps #
##################
# Modules
ARG MODULES="00-banner.sh"
# Automatic modules download
RUN mkdir -p /tmpscripts /etc/cont-init.d && \
for scripts in $MODULES; do curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/$scripts" -o /tmpscripts/"$scripts"; done && \
if [ -d /etc/cont-init.d ]; then /bin/cp -rf /tmpscripts/* /etc/cont-init.d/ && chmod -R 755 /etc/cont-init.d; fi && \
if [ -d /scripts ]; then /bin/cp -rf /tmpscripts/* /scripts/ && chmod -R 755 /scripts; fi && \
rm -rf /tmpscripts || printf '%s\n' "${MODULES:-}" > /MODULESFILE
################
# 4 Entrypoint #
################
#WORKDIR /
RUN chmod 777 /entrypoint.sh
ENTRYPOINT [ "/usr/bin/env" ]
CMD [ "/entrypoint.sh" ]
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
############
# 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}

55
tandoor_recipes/README.md Normal file
View File

@@ -0,0 +1,55 @@
# Hass.io Add-ons: Tandoor recipes
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
![Supports
Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
![Supports smb mounts][smb-shield]
_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_
[![Stargazers repo roster for @alexbelgium/hassio-addons](https://reporoster.com/stars/alexbelgium/hassio-addons)](https://github.com/alexbelgium/hassio-addons/stargazers)
## About
[Tandoor recipes](https://github.com/TandoorRecipes/recipes) is meant for people with a collection of recipes they want to share with family and friends or simply store them in a nicely organized way. A basic permission system exists but this application is not meant to be run as a public page.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
## Configuration
- Start the addon. Wait a while and check the log for any errors.
- Open yourdomain.com:8000 (where ":8000" is the port configured in the addon).
- Default
- Username: `admin`
- Password: `adminadmin`
```yaml
```
## Support
If you have in issue with your installation, please be sure to checkout github.
[repository]: https://github.com/alexbelgium/hassio-addons
[smb-shield]: https://img.shields.io/badge/smb-yes-green.svg
[openvpn-shield]: https://img.shields.io/badge/openvpn-yes-green.svg
[ingress-shield]: https://img.shields.io/badge/ingress-yes-green.svg
[ssl-shield]: https://img.shields.io/badge/ssl-yes-green.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg

View File

@@ -0,0 +1,8 @@
{
"build_from": {
"armhf": "vabene1111/recipes:arm32v7-latest",
"armv7": "vabene1111/recipes:arm32v7-latest",
"aarch64": "vabene1111/recipes:arm64v8-latest",
"amd64": "vabene1111/recipes:amd64-latest"
}
}

View File

@@ -0,0 +1,35 @@
{
"arch": ["aarch64", "amd64", "armv7", "armhf"],
"boot": "auto",
"description": "recipe manager",
"environment": {},
"map": ["share:rw", "ssl:ro"],
"name": "Tandoor recipes",
"options": {
"SECRET_KEY": "YOUR_SECRET_KEY",
"DB_TYPE": "sqlite",
"ALLOWED_HOSTS": ""
},
"ports": {
"8080/tcp": "9928"
},
"ports_description": {
"8080/tcp": "Web interface"
},
"services": ["mysql:want"],
"schema": {
"SECRET_KEY": "str",
"DB_TYPE": "list(sqlite|postgresql_external|mariadb_addon)",
"ALLOWED_HOSTS": "str?",
"POSTGRES_HOST": "str?",
"POSTGRES_PORT": "str?",
"POSTGRES_USER": "str?",
"POSTGRES_PASSWORD": "str?",
"POSTGRES_DB": "str?"
},
"slug": "tandoor_recipes",
"upstream": "1.9",
"url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.9",
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]"
}

BIN
tandoor_recipes/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
tandoor_recipes/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,15 @@
#!/bin/bash
echo "Starting..."
####################
# Starting scripts #
####################
for SCRIPTS in /scripts/*; do
[ -e "$SCRIPTS" ] || continue
echo "$SCRIPTS: executing"
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
chmod a+x "$SCRIPTS"
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' "$SCRIPTS" || true
/./"$SCRIPTS" || echo "$SCRIPTS: exiting $?"
done

View File

@@ -0,0 +1,18 @@
#!/bin/bash
# If dockerfile failed install manually
if [ -e "/ENVFILE" ]; then
echo "Executing script"
PACKAGES=$(</ENVFILE)
(
#######################
# 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

@@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bashio
cp -r /opt/recipes /data/recipes
chmod -R 755 /data/recipes
mkdir -p /data/recipes/media
mkdir -p /data/recipes/static

View File

@@ -0,0 +1,62 @@
#!/usr/bin/with-contenv bashio
#####################
# Export env values #
#####################
export ALLOWED_HOSTS=$(bashio::config 'ALLOWED_HOSTS') && bashio::log.blue "ALLOWED_HOSTS=$ALLOWED_HOSTS"
###################
# Define database #
###################
bashio::log.info "Defining database"
export DB_TYPE=$(bashio::config 'DB_TYPE')
case $(bashio::config 'DB_TYPE') in
# Use sqlite
sqlite)
bashio::log.info "Using a local sqlite database"
export DB_ENGINE="django.db.backends.sqlite3"
export POSTGRES_DB="/data/recipes.db"
;;
mariadb_addon)
bashio::log.info "Using MariaDB addon. Requirements : running MariaDB addon. Discovering values..."
if ! bashio::services.available 'mysql'; then
bashio::log.fatal \
"Local database access should be provided by the MariaDB addon"
bashio::exit.nok \
"Please ensure it is installed and started"
fi
# Use values
export DB_ENGINE=django.db.backends.postgresql
export POSTGRES_HOST=$(bashio::services "mysql" "host") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
export POSTGRES_PORT=$(bashio::services "mysql" "port") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT"
export POSTGRES_DB=/data/recipes.db && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB"
export POSTGRES_USER=$(bashio::services "mysql" "username") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER"
export POSTGRES_PASSWORD=$(bashio::services "mysql" "password") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD"
bashio::log.warning "Webtrees is using the Maria DB addon"
bashio::log.warning "Please ensure this is included in your backups"
bashio::log.warning "Uninstalling the MariaDB addon will remove any data"
;;
postgresql_external)
bashio::log.info "Using an external database, please populate all required fields in the addons config"
export DB_ENGINE=django.db.backends.postgresql
export POSTGRES_HOST=$(bashio::config "POSTGRES_HOST") && bashio::log.blue "POSTGRES_HOST=$POSTGRES_HOST"
export POSTGRES_PORT=$(bashio::config "POSTGRES_PORT") && bashio::log.blue "POSTGRES_PORT=$POSTGRES_PORT"
export POSTGRES_DB=$(bashio::config "POSTGRES_DB") && bashio::log.blue "POSTGRES_DB=$POSTGRES_DB"
export POSTGRES_USER=$(bashio::config "POSTGRES_USER") && bashio::log.blue "POSTGRES_USER=$POSTGRES_USER"
export POSTGRES_PASSWORD=$(bashio::config "POSTGRES_PASSWORD") && bashio::log.blue "POSTGRES_PASSWORD=$POSTGRES_PASSWORD"
;;
esac
##############
# Launch app #
##############
/./opt/recipes/boot.sh