Skip to content

Commit 768932c

Browse files
committed
chore: fixup gnupg key fetching logic (telegraf)
1 parent 2ad6838 commit 768932c

File tree

5 files changed

+43
-45
lines changed

5 files changed

+43
-45
lines changed

telegraf/1.21/alpine/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
FROM alpine:3.15
22

33
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
4-
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap && \
4+
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap gnupg && \
55
update-ca-certificates
66

7+
RUN for attempt in 1 2 3 ; \
8+
do \
9+
sleep 1 && \
10+
gpg --yes --batch --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys \
11+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 && \
12+
break ; \
13+
done
14+
715
ENV TELEGRAF_VERSION 1.21.4
816

917
RUN set -ex && \
10-
mkdir ~/.gnupg; \
11-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
12-
apk add --no-cache --virtual .build-deps wget gnupg tar && \
13-
for key in \
14-
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
15-
do \
16-
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
17-
done && \
18+
apk add --no-cache --virtual .build-deps wget tar && \
1819
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc && \
1920
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
2021
gpg --batch --verify telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
@@ -23,8 +24,7 @@ RUN set -ex && \
2324
mv /usr/src/telegraf*/etc/telegraf/telegraf.conf /etc/telegraf/ && \
2425
mkdir /etc/telegraf/telegraf.d && \
2526
cp -a /usr/src/telegraf*/usr/bin/telegraf /usr/bin/ && \
26-
gpgconf --kill all && \
27-
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
27+
rm -rf *.tar.gz* /usr/src && \
2828
apk del .build-deps && \
2929
addgroup -S telegraf && \
3030
adduser -S telegraf -G telegraf && \

telegraf/1.22/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
44
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends iputils-ping snmp procps lm-sensors libcap2-bin && \
55
rm -rf /var/lib/apt/lists/*
66

7-
RUN set -ex && \
8-
mkdir ~/.gnupg; \
9-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
10-
for key in \
11-
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
7+
RUN for attempt in 1 2 3 ; \
128
do \
13-
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
9+
sleep 1 && \
10+
gpg --yes --batch --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys \
11+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 && \
12+
break ; \
1413
done
1514

1615
ENV TELEGRAF_VERSION 1.22.4

telegraf/1.22/alpine/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
FROM alpine:3.16
22

33
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
4-
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap && \
4+
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap gnupg && \
55
update-ca-certificates
66

7+
RUN for attempt in 1 2 3 ; \
8+
do \
9+
sleep 1 && \
10+
gpg --yes --batch --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys \
11+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 && \
12+
break ; \
13+
done
14+
715
ENV TELEGRAF_VERSION 1.22.4
816

917
RUN set -ex && \
10-
mkdir ~/.gnupg; \
11-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
12-
apk add --no-cache --virtual .build-deps wget gnupg tar && \
13-
for key in \
14-
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
15-
do \
16-
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
17-
done && \
18+
apk add --no-cache --virtual .build-deps wget tar && \
1819
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc && \
1920
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
2021
gpg --batch --verify telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
@@ -23,8 +24,7 @@ RUN set -ex && \
2324
mv /usr/src/telegraf*/etc/telegraf/telegraf.conf /etc/telegraf/ && \
2425
mkdir /etc/telegraf/telegraf.d && \
2526
cp -a /usr/src/telegraf*/usr/bin/telegraf /usr/bin/ && \
26-
gpgconf --kill all && \
27-
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
27+
rm -rf *.tar.gz* /usr/src && \
2828
apk del .build-deps && \
2929
addgroup -S telegraf && \
3030
adduser -S telegraf -G telegraf && \

telegraf/1.23/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
44
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends iputils-ping snmp procps lm-sensors libcap2-bin && \
55
rm -rf /var/lib/apt/lists/*
66

7-
RUN set -ex && \
8-
mkdir ~/.gnupg; \
9-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
10-
for key in \
11-
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
7+
RUN for attempt in 1 2 3 ; \
128
do \
13-
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
9+
sleep 1 && \
10+
gpg --yes --batch --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys \
11+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 && \
12+
break ; \
1413
done
1514

1615
ENV TELEGRAF_VERSION 1.23.4

telegraf/1.23/alpine/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
FROM alpine:3.16
22

33
RUN echo 'hosts: files dns' >> /etc/nsswitch.conf
4-
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap && \
4+
RUN apk add --no-cache iputils ca-certificates net-snmp-tools procps lm_sensors tzdata su-exec libcap gnupg && \
55
update-ca-certificates
66

7+
RUN for attempt in 1 2 3 ; \
8+
do \
9+
sleep 1 && \
10+
gpg --yes --batch --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys \
11+
05CE15085FC09D18E99EFB22684A14CF2582E0C5 && \
12+
break ; \
13+
done
14+
715
ENV TELEGRAF_VERSION 1.23.4
816

917
RUN set -ex && \
10-
mkdir ~/.gnupg; \
11-
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
12-
apk add --no-cache --virtual .build-deps wget gnupg tar && \
13-
for key in \
14-
05CE15085FC09D18E99EFB22684A14CF2582E0C5 ; \
15-
do \
16-
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "$key" ; \
17-
done && \
18+
apk add --no-cache --virtual .build-deps wget tar && \
1819
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc && \
1920
wget --no-verbose https://dl.influxdata.com/telegraf/releases/telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
2021
gpg --batch --verify telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz.asc telegraf-${TELEGRAF_VERSION}_static_linux_amd64.tar.gz && \
@@ -23,8 +24,7 @@ RUN set -ex && \
2324
mv /usr/src/telegraf*/etc/telegraf/telegraf.conf /etc/telegraf/ && \
2425
mkdir /etc/telegraf/telegraf.d && \
2526
cp -a /usr/src/telegraf*/usr/bin/telegraf /usr/bin/ && \
26-
gpgconf --kill all && \
27-
rm -rf *.tar.gz* /usr/src /root/.gnupg && \
27+
rm -rf *.tar.gz* /usr/src && \
2828
apk del .build-deps && \
2929
addgroup -S telegraf && \
3030
adduser -S telegraf -G telegraf && \

0 commit comments

Comments
 (0)