From 1b10bb75d17fc3e0d6c4078702cf87f7355a7500 Mon Sep 17 00:00:00 2001 From: napnap75 Date: Sat, 9 Jan 2021 15:24:55 +0100 Subject: [PATCH] Added Telegraf --- .github/workflows/build.yml | 2 +- telegraf/Dockerfile | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 telegraf/Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 304cdce..6400968 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - repository: [restic-auto, influxdb] + repository: [restic-auto, influxdb, telegraf] steps: - name: Checkout diff --git a/telegraf/Dockerfile b/telegraf/Dockerfile new file mode 100644 index 0000000..5f88eb2 --- /dev/null +++ b/telegraf/Dockerfile @@ -0,0 +1,25 @@ +FROM alpine:latest AS builder + +ARG TARGETPLATFORM + +RUN apk add --no-cache curl jq \ + && VERSION=$(curl -s https://api.github.com/repos/influxdata/telegraf/releases/latest | jq '.name' | sed -E "s/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/") \ + && curl -s -o entrypoint.sh https://raw.githubusercontent.com/influxdata/influxdata-docker/master/telegraf/1.17/alpine/entrypoint.sh \ + && DOWNLOAD_ARCH=$(echo ${TARGETPLATFORM} | sed "s#/#_#") \ + && curl -s -o telegraf.tgz https://dl.influxdata.com/telegraf/releases/telegraf-${VERSION}_${DOWNLOAD_ARCH}.tar.gz \ + && tar -z -x -f telegraf.tgz + +FROM alpine:3.12 + +COPY --from=builder telegraf*/usr/bin/telegraf /usr/bin/ +COPY --from=builder entrypoint.sh /entrypoint.sh + +RUN echo 'hosts: files dns' >> /etc/nsswitch.conf \ + && apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata \ + && update-ca-certificates \ + && chmod +x /usr/bin/telegraf /entrypoint.sh + +EXPOSE 8125/udp 8092/udp 8094 + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["telegraf"]