This commit is contained in:
mezned 2024-11-10 18:17:17 +01:00
parent 36a8e795d9
commit 55b501ccd2

View File

@ -39,26 +39,21 @@ RUN case "${BUILD_ARCH}" in \
chmod +x /etc/cont-init.d/promtail_setup.sh; \ chmod +x /etc/cont-init.d/promtail_setup.sh; \
chmod +x /etc/services.d/promtail/*; chmod +x /etc/services.d/promtail/*;
# Install necessary packages # Install dependencies for building Promtail
RUN apk add --no-cache curl tar unzip && \ RUN apk add --no-cache go git build-base
# 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
# Download and install Promtail # Download the Promtail source code
RUN curl -s -J -L -o promtail-linux-amd64.zip \ RUN git clone --branch "v${PROMTAIL_VERSION}" https://github.com/grafana/loki.git /promtail-src
"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
# 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 RUN /usr/bin/promtail -version
WORKDIR /data/promtail WORKDIR /data/promtail