From 55b501ccd23e8db84c2000380b0105bb7533fb3d Mon Sep 17 00:00:00 2001 From: mezned Date: Sun, 10 Nov 2024 18:17:17 +0100 Subject: [PATCH] update --- promtail/Dockerfile | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/promtail/Dockerfile b/promtail/Dockerfile index dd587c8..2036b5a 100644 --- a/promtail/Dockerfile +++ b/promtail/Dockerfile @@ -39,26 +39,21 @@ RUN case "${BUILD_ARCH}" in \ chmod +x /etc/cont-init.d/promtail_setup.sh; \ chmod +x /etc/services.d/promtail/*; -# Install necessary packages -RUN apk add --no-cache curl tar unzip && \ - # Remove nsswitch.conf to avoid conflicts with glibc - rm -f /etc/nsswitch.conf && \ - # Add the public key for sgerrand glibc packages - curl -Lo /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ - # Download and install glibc - curl -Lo glibc.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk && \ - apk add glibc.apk && \ - rm glibc.apk +# Install dependencies for building Promtail +RUN apk add --no-cache go git build-base -# Download and install Promtail -RUN curl -s -J -L -o promtail-linux-amd64.zip \ - "https://github.com/grafana/loki/releases/download/v${PROMTAIL_VERSION}/promtail-linux-amd64.zip" && \ - unzip promtail-linux-amd64.zip -d /usr/bin && \ - mv /usr/bin/promtail-linux-amd64 /usr/bin/promtail && \ - chmod a+x /usr/bin/promtail && \ - rm promtail-linux-amd64.zip +# Download the Promtail source code +RUN git clone --branch "v${PROMTAIL_VERSION}" https://github.com/grafana/loki.git /promtail-src -# Verify Promtail installation +# Build Promtail +WORKDIR /promtail-src/clients/cmd/promtail +RUN go build -o /usr/bin/promtail + +# Clean up source and unnecessary packages +RUN apk del go git build-base && \ + rm -rf /promtail-src + +# Verify the installation RUN /usr/bin/promtail -version WORKDIR /data/promtail