Skip to content

Commit 553a060

Browse files
committed
Replace apt-key with gpg
apt-key has been deprecated
1 parent fe8a041 commit 553a060

File tree

6 files changed

+42
-18
lines changed

6 files changed

+42
-18
lines changed

Dockerfile-debian-perl.template

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,33 @@ RUN set -x \
1111
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
1212
&& \
1313
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
14+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
15+
export GNUPGHOME="$(mktemp -d)"; \
1416
found=''; \
1517
for server in \
1618
hkp://keyserver.ubuntu.com:80 \
1719
pgp.mit.edu \
1820
; do \
1921
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
20-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
22+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
2123
done; \
2224
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
25+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
26+
rm -rf "$GNUPGHOME"; \
2327
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
2428
&& dpkgArch="$(dpkg --print-architecture)" \
2529
&& nginxPackages="%%PACKAGES%%
2630
" \
2731
&& case "$dpkgArch" in \
2832
amd64|arm64) \
2933
# arches officialy built by upstream
30-
echo "deb %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
34+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
3135
&& apt-get update \
3236
;; \
3337
*) \
3438
# we're on an architecture upstream doesn't officially build for
3539
# let's build binaries from the published source packages
36-
echo "deb-src %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
40+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
3741
\
3842
# new directory for storing sources and .deb files
3943
&& tempDir="$(mktemp -d)" \

Dockerfile-debian.template

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,33 @@ RUN set -x \
1818
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
1919
&& \
2020
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
21+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
22+
export GNUPGHOME="$(mktemp -d)"; \
2123
found=''; \
2224
for server in \
2325
hkp://keyserver.ubuntu.com:80 \
2426
pgp.mit.edu \
2527
; do \
2628
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
27-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
29+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
2830
done; \
2931
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
32+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
33+
rm -rf "$GNUPGHOME"; \
3034
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
3135
&& dpkgArch="$(dpkg --print-architecture)" \
3236
&& nginxPackages="%%PACKAGES%%
3337
" \
3438
&& case "$dpkgArch" in \
3539
amd64|arm64) \
3640
# arches officialy built by upstream
37-
echo "deb %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
41+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
3842
&& apt-get update \
3943
;; \
4044
*) \
4145
# we're on an architecture upstream doesn't officially build for
4246
# let's build binaries from the published source packages
43-
echo "deb-src %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
47+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
4448
\
4549
# new directory for storing sources and .deb files
4650
&& tempDir="$(mktemp -d)" \

mainline/debian-perl/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ RUN set -x \
1616
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
1717
&& \
1818
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
19+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
20+
export GNUPGHOME="$(mktemp -d)"; \
1921
found=''; \
2022
for server in \
2123
hkp://keyserver.ubuntu.com:80 \
2224
pgp.mit.edu \
2325
; do \
2426
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
25-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
27+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
2628
done; \
2729
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
30+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
31+
rm -rf "$GNUPGHOME"; \
2832
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
2933
&& dpkgArch="$(dpkg --print-architecture)" \
3034
&& nginxPackages=" \
@@ -38,13 +42,13 @@ RUN set -x \
3842
&& case "$dpkgArch" in \
3943
amd64|arm64) \
4044
# arches officialy built by upstream
41-
echo "deb https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
45+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4246
&& apt-get update \
4347
;; \
4448
*) \
4549
# we're on an architecture upstream doesn't officially build for
4650
# let's build binaries from the published source packages
47-
echo "deb-src https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
51+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4852
\
4953
# new directory for storing sources and .deb files
5054
&& tempDir="$(mktemp -d)" \

mainline/debian/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ RUN set -x \
2323
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
2424
&& \
2525
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
26+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
27+
export GNUPGHOME="$(mktemp -d)"; \
2628
found=''; \
2729
for server in \
2830
hkp://keyserver.ubuntu.com:80 \
2931
pgp.mit.edu \
3032
; do \
3133
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
32-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
34+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
3335
done; \
3436
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
37+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
38+
rm -rf "$GNUPGHOME"; \
3539
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
3640
&& dpkgArch="$(dpkg --print-architecture)" \
3741
&& nginxPackages=" \
@@ -44,13 +48,13 @@ RUN set -x \
4448
&& case "$dpkgArch" in \
4549
amd64|arm64) \
4650
# arches officialy built by upstream
47-
echo "deb https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
51+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4852
&& apt-get update \
4953
;; \
5054
*) \
5155
# we're on an architecture upstream doesn't officially build for
5256
# let's build binaries from the published source packages
53-
echo "deb-src https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
57+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
5458
\
5559
# new directory for storing sources and .deb files
5660
&& tempDir="$(mktemp -d)" \

stable/debian-perl/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ RUN set -x \
1616
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
1717
&& \
1818
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
19+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
20+
export GNUPGHOME="$(mktemp -d)"; \
1921
found=''; \
2022
for server in \
2123
hkp://keyserver.ubuntu.com:80 \
2224
pgp.mit.edu \
2325
; do \
2426
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
25-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
27+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
2628
done; \
2729
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
30+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
31+
rm -rf "$GNUPGHOME"; \
2832
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
2933
&& dpkgArch="$(dpkg --print-architecture)" \
3034
&& nginxPackages=" \
@@ -38,13 +42,13 @@ RUN set -x \
3842
&& case "$dpkgArch" in \
3943
amd64|arm64) \
4044
# arches officialy built by upstream
41-
echo "deb https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
45+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4246
&& apt-get update \
4347
;; \
4448
*) \
4549
# we're on an architecture upstream doesn't officially build for
4650
# let's build binaries from the published source packages
47-
echo "deb-src https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
51+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4852
\
4953
# new directory for storing sources and .deb files
5054
&& tempDir="$(mktemp -d)" \

stable/debian/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ RUN set -x \
2323
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
2424
&& \
2525
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
26+
NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
27+
export GNUPGHOME="$(mktemp -d)"; \
2628
found=''; \
2729
for server in \
2830
hkp://keyserver.ubuntu.com:80 \
2931
pgp.mit.edu \
3032
; do \
3133
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
32-
apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
34+
gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
3335
done; \
3436
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
37+
gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
38+
rm -rf "$GNUPGHOME"; \
3539
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
3640
&& dpkgArch="$(dpkg --print-architecture)" \
3741
&& nginxPackages=" \
@@ -44,13 +48,13 @@ RUN set -x \
4448
&& case "$dpkgArch" in \
4549
amd64|arm64) \
4650
# arches officialy built by upstream
47-
echo "deb https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
51+
echo "deb [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
4852
&& apt-get update \
4953
;; \
5054
*) \
5155
# we're on an architecture upstream doesn't officially build for
5256
# let's build binaries from the published source packages
53-
echo "deb-src https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
57+
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bullseye nginx" >> /etc/apt/sources.list.d/nginx.list \
5458
\
5559
# new directory for storing sources and .deb files
5660
&& tempDir="$(mktemp -d)" \

0 commit comments

Comments
 (0)