@@ -14,29 +14,33 @@ RUN set -x \
14
14
&& apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates \
15
15
&& \
16
16
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
17
+ NGINX_GPGKEY_PATH=/usr/share/keyrings/nginx-archive-keyring.gpg; \
18
+ export GNUPGHOME="$(mktemp -d)"; \
17
19
found=''; \
18
20
for server in \
19
21
hkp://keyserver.ubuntu.com:80 \
20
22
pgp.mit.edu \
21
23
; do \
22
24
echo "Fetching GPG key $NGINX_GPGKEY from $server"; \
23
- apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
25
+ gpg1 --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; \
24
26
done; \
25
27
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
28
+ gpg1 --export "$NGINX_GPGKEY" > "$NGINX_GPGKEY_PATH" ; \
29
+ rm -rf "$GNUPGHOME"; \
26
30
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
27
31
&& dpkgArch="$(dpkg --print-architecture)" \
28
32
&& nginxPackages="%%PACKAGES%%
29
33
" \
30
34
&& case "$dpkgArch" in \
31
35
amd64|arm64) \
32
36
# arches officialy built by upstream
33
- echo "deb %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
37
+ echo "deb [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
34
38
&& apt-get update \
35
39
;; \
36
40
*) \
37
41
# we're on an architecture upstream doesn't officially build for
38
42
# let's build binaries from the published source packages
39
- echo "deb-src %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
43
+ echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
40
44
\
41
45
# new directory for storing sources and .deb files
42
46
&& tempDir="$(mktemp -d)" \
0 commit comments