Fix
This commit is contained in:
@@ -1,34 +1,44 @@
|
||||
ARG BUILD_FROM
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
# Set shell
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Setup base system
|
||||
ARG BUILD_ARCH=amd64
|
||||
|
||||
ARG TELEGRAF_VERSION
|
||||
|
||||
# Setup base
|
||||
RUN \
|
||||
apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
iputils-ping snmp procps lm-sensors smartmontools ipmitool \
|
||||
&& ARCH="${BUILD_ARCH}" \
|
||||
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
|
||||
&& if [ "${BUILD_ARCH}" = "armv7" ]; then ARCH="armhf"; fi \
|
||||
&& curl -J -L -o /tmp/telegraf.deb \
|
||||
"https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb" \
|
||||
&& dpkg --install /tmp/telegraf.deb \
|
||||
&& rm -fr \
|
||||
/tmp/* \
|
||||
/var/{cache,log}/* \
|
||||
/var/lib/apt/lists/*
|
||||
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
|
||||
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap && \
|
||||
update-ca-certificates
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
ENV TELEGRAF_VERSION ${TELEGRAF_VERSION}
|
||||
|
||||
EXPOSE 8092/udp 8094 8125/udp 9273/tcp
|
||||
RUN set -ex && \
|
||||
mkdir ~/.gnupg; \
|
||||
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
|
||||
apk add --no-cache --virtual .build-deps wget gnupg tar && \
|
||||
for key in \
|
||||
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
|
||||
do \
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||
done && \
|
||||
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc && \
|
||||
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
|
||||
gpg --batch --verify telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
|
||||
mkdir -p /usr/src /etc/telegraf && \
|
||||
tar -C /usr/src -xzf telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
|
||||
mv /usr/src/telegraf*/etc/telegraf/telegraf.conf /etc/telegraf/ && \
|
||||
mkdir /etc/telegraf/telegraf.d && \
|
||||
cp -a /usr/src/telegraf*/usr/bin/telegraf /usr/bin/ && \
|
||||
gpgconf --kill all && \
|
||||
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
|
||||
apk del .build-deps && \
|
||||
addgroup -S telegraf && \
|
||||
adduser -S telegraf -G telegraf && \
|
||||
chown -R telegraf:telegraf /etc/telegraf
|
||||
|
||||
EXPOSE 8125/udp 8092/udp 8094
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["telegraf"]
|
||||
|
||||
# Build arguments
|
||||
ARG BUILD_ARCH
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
build_from:
|
||||
aarch64: ghcr.io/hassio-addons/debian-base/aarch64:6.0.0
|
||||
amd64: ghcr.io/hassio-addons/debian-base/amd64:6.0.0
|
||||
armhf: ghcr.io/hassio-addons/debian-base/armhf:6.0.0
|
||||
armv7: ghcr.io/hassio-addons/debian-base/armv7:6.0.0
|
||||
i386: ghcr.io/hassio-addons/debian-base/i386:6.0.0
|
||||
aarch64: alpine:3.15
|
||||
amd64: alpine:3.15
|
||||
armhf: alpine:3.15
|
||||
armv7: alpine:3.15
|
||||
i386: alpine:3.15
|
||||
args:
|
||||
TELEGRAF_VERSION: 1.23.0
|
||||
15
telegraf/entrypoint.sh
Normal file
15
telegraf/entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "${1:0:1}" = '-' ]; then
|
||||
set -- telegraf "$@"
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
exec "$@"
|
||||
else
|
||||
# Allow telegraf to send ICMP packets and bind to privliged ports
|
||||
setcap cap_net_raw,cap_net_bind_service+ep /usr/bin/telegraf || echo "Failed to set additional capabilities on /usr/bin/telegraf"
|
||||
|
||||
exec su-exec telegraf "$@"
|
||||
fi
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on:
|
||||
# This file turns s6-nuke into a NOOP to prevent total termination
|
||||
# of the host system since the add-on runs in the same PID namespace.
|
||||
# ==============================================================================
|
||||
echo "S6-NUKE: NOOP"
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Telegraf
|
||||
# Configures Telegraf
|
||||
# ==============================================================================
|
||||
declare hostname
|
||||
bashio::require.unprotected
|
||||
|
||||
readonly CONFIG="/etc/telegraf/telegraf.conf"
|
||||
|
||||
CUSTOM_CONF=$(bashio::config 'custom_conf.location')
|
||||
|
||||
bashio::log.info "Using custom conf file"
|
||||
rm /etc/telegraf/telegraf.conf
|
||||
cp "${CUSTOM_CONF}" /etc/telegraf/telegraf.conf
|
||||
|
||||
bashio::log.info "Finished updating config"
|
||||
@@ -1,3 +0,0 @@
|
||||
/etc/telegraf/telegraf.conf false root 0755 0755
|
||||
/usr/bin/tele.sh false root 0755 0755
|
||||
/usr/bin/telegraf.sh false root 0755 0755
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Telegraf
|
||||
# ==============================================================================
|
||||
if -n { s6-test $# -ne 0 }
|
||||
if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
#s6-svscanctl -t /var/run/s6/services
|
||||
/run/s6/basedir/bin/halt
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Example
|
||||
# Runs example1 script
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
bashio::log.info "Starting Telegraf"
|
||||
|
||||
exec telegraf
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user