From fa3011b369caa50824882f7d9e83fc642cd0e5a5 Mon Sep 17 00:00:00 2001 From: ElevenNotes Date: Fri, 27 Oct 2023 11:02:53 +0200 Subject: [PATCH] update 1.28.3 --- README.md | 10 +++++----- amd64.dockerfile | 19 ++++++++----------- rootfs/usr/local/bin/entrypoint.sh | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index dedb292..e5c27ed 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Alpine :: Telegraf -![pulls](https://img.shields.io/docker/pulls/11notes/telegraf?color=2b75d6) ![build](https://img.shields.io/docker/automated/11notes/telegraf?color=2b75d6) ![activity](https://img.shields.io/github/commit-activity/m/11notes/docker-telegraf?color=c91cb8) ![commit-last](https://img.shields.io/github/last-commit/11notes/docker-telegraf?color=c91cb8) +![size](https://img.shields.io/docker/image-size/11notes/telegraf/1.28.3?color=0eb305) ![version](https://img.shields.io/docker/v/11notes/telegraf?color=eb7a09) ![pulls](https://img.shields.io/docker/pulls/11notes/telegraf?color=2b75d6) ![activity](https://img.shields.io/github/commit-activity/m/11notes/docker-telegraf?color=c91cb8) ![commit-last](https://img.shields.io/github/last-commit/11notes/docker-telegraf?color=c91cb8) Run Telegraf based on Alpine Linux. Small, lightweight, secure and fast 🏔️ ## Run ```shell docker run --name telegraf \ - -v /.../telegraf.conf:/telegraf/etc/telegraf.conf:ro \ + -v ../telegraf.conf:/telegraf/etc/telegraf.conf:ro \ -d 11notes/telegraf:[tag] ``` @@ -33,7 +33,7 @@ docker run --name telegraf \ hostname = "telegraf" [[outputs.influxdb_v2]] - urls = ["http://localhost:8086"] + urls = ["https://influxdb"] token = "**********************************************" organization = "influxdb" bucket = "global" @@ -42,10 +42,10 @@ docker run --name telegraf \ urls = ["http://localhost:8080/metrics"] ``` -## Parent +## Parent image * [11notes/alpine:stable](https://github.com/11notes/docker-alpine) -## Built with +## Built with and thanks to * [telegraf](https://github.com/influxdata/telegraf) * [Alpine Linux](https://alpinelinux.org/) diff --git a/amd64.dockerfile b/amd64.dockerfile index e134625..caf272d 100644 --- a/amd64.dockerfile +++ b/amd64.dockerfile @@ -1,6 +1,6 @@ # :: Build FROM golang:alpine as build - ENV checkout=v1.28.1 + ENV APP_VERSION=v1.28.3 RUN set -ex; \ apk add --update --no-cache \ @@ -8,26 +8,23 @@ git; \ git clone https://github.com/influxdata/telegraf.git; \ cd /go/telegraf; \ - git checkout ${checkout}; \ + git checkout ${APP_VERSION}; \ make build -j $(nproc); \ mv telegraf /usr/local/bin; # :: Header FROM 11notes/alpine:stable + ENV APP_ROOT=/telegraf COPY --from=build /usr/local/bin/ /usr/local/bin # :: Run USER root - # :: update image - RUN set -ex; \ - apk --no-cache upgrade; - - # :: prepare image RUN set -ex; \ - mkdir -p /telegraf; \ - mkdir -p /telegraf/etc; + mkdir -p ${APP_ROOT}; \ + mkdir -p ${APP_ROOT}/etc; \ + apk --no-cache upgrade; # :: copy root filesystem changes and add execution rights to init scripts COPY ./rootfs / @@ -36,9 +33,9 @@ # :: change home path for existing user and set correct permission RUN set -ex; \ - usermod -d /telegraf docker; \ + usermod -d ${APP_ROOT} docker; \ chown -R 1000:1000 \ - /telegraf; + ${APP_ROOT}; # :: Start USER docker diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 453111e..de5ef26 100644 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/ash if [ -z "${1}" ]; then set -- "telegraf" \ - --config /telegraf/etc/telegraf.conf + --config ${APP_ROOT}/etc/telegraf.conf fi exec "$@" \ No newline at end of file