@@ -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)" \
0 commit comments