feat: add coredns
This commit is contained in:
26
coredns/Dockerfile
Normal file
26
coredns/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:7.8.2
|
||||||
|
# hadolint ignore=DL3006
|
||||||
|
FROM ${BUILD_FROM}
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
ARG COREDNS_VERSION=1.12.1
|
||||||
|
|
||||||
|
WORKDIR /coredns
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y ca-certificates libcap2-bin \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& curl -sSL -o coredns.tgz \
|
||||||
|
https://github.com/coredns/coredns/releases/download/v${COREDNS_VERSION}/coredns_${COREDNS_VERSION}_linux_arm64.tgz \
|
||||||
|
&& tar -xvf coredns.tgz \
|
||||||
|
&& chmod +x coredns
|
||||||
|
|
||||||
|
LABEL \
|
||||||
|
org.opencontainers.image.title="CoreDNS Add-on" \
|
||||||
|
org.opencontainers.image.description="CoreDNS server for Home Assistant" \
|
||||||
|
org.opencontainers.image.url="https://coredns.io" \
|
||||||
|
org.opencontainers.image.source="https://github.com/coredns/coredns" \
|
||||||
|
org.opencontainers.image.documentation="https://coredns.io/manual"
|
||||||
|
|
||||||
|
COPY rootfs /
|
||||||
5
coredns/build.yaml
Normal file
5
coredns/build.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
build_from:
|
||||||
|
amd64: ghcr.io/hassio-addons/debian-base/amd64:7.8.2
|
||||||
|
codenotary:
|
||||||
|
base_image: codenotary@frenck.dev
|
||||||
17
coredns/config.yaml
Normal file
17
coredns/config.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: "Coredns"
|
||||||
|
version: "1.12.1"
|
||||||
|
slug: "coredns"
|
||||||
|
description: "CoreDNS is a DNS server that chains plugins "
|
||||||
|
url: "https://coredns.io/"
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
boot: auto
|
||||||
|
init: false
|
||||||
|
startup: services
|
||||||
|
map:
|
||||||
|
- addon_config:rw
|
||||||
|
options: {}
|
||||||
|
schema: {}
|
||||||
|
ports:
|
||||||
|
53/tcp: 53
|
||||||
|
53/udp: 53
|
||||||
BIN
coredns/icon.png
Normal file
BIN
coredns/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
coredns/logo.png
Normal file
BIN
coredns/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
45
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/finish
Normal file
45
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/finish
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Add-on: CoreDNS
|
||||||
|
# ==============================================================================
|
||||||
|
declare exit_code
|
||||||
|
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
|
||||||
|
readonly exit_code_service="${1}"
|
||||||
|
readonly exit_code_signal="${2}"
|
||||||
|
readonly service="coredns"
|
||||||
|
|
||||||
|
bashio::log.info \
|
||||||
|
"Service ${service} exited with code ${exit_code_service}" \
|
||||||
|
"(by signal ${exit_code_signal})"
|
||||||
|
|
||||||
|
# Received a signal
|
||||||
|
if [[ "${exit_code_service}" -eq 256 ]]; then
|
||||||
|
|
||||||
|
# The signal might be a result of another service crashing. Only
|
||||||
|
# overwrite the container exit code if it is not already set.
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the signal is SIGTERM, we should halt the container and take down
|
||||||
|
# the whole process tree.
|
||||||
|
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
|
||||||
|
|
||||||
|
# The service exited with a non-zero exit code, which means it crashed.
|
||||||
|
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
||||||
|
|
||||||
|
# The service might be a result of another service crashing. Only
|
||||||
|
# overwrite the container exit code if it is not already set.
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We should halt the container and take down the whole process tree.
|
||||||
|
exec /run/s6/basedir/bin/halt
|
||||||
|
|
||||||
|
# The service exited with a zero exit code, which means it exited, let
|
||||||
|
# S6 supervision restart it.
|
||||||
|
else
|
||||||
|
bashio::log.info "Service ${service} restarting..."
|
||||||
|
fi
|
||||||
9
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/run
Normal file
9
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/run
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Add-on: CoreDNS
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
bashio::log.info "Starting CoreDNS..."
|
||||||
|
|
||||||
|
exec /coredns --conf /config/Corefile
|
||||||
1
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/type
Normal file
1
coredns/rootfs/etc/s6-overlay/s6-rc.d/coredns/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
Reference in New Issue
Block a user