From 793949e12af683ef2dbba5640eaf4ff2458d0c57 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Wed, 23 Aug 2017 14:19:34 +0100 Subject: base: add support for fetching APT keys from files For RPM distros we use GPG keys as URLs because rpm can handle it. For Debian based distros we fetch GPG keys from ubuntu keyserver. But it does not work with OBS repositories where key is provided as file in repo. This change adds support for fetching GPG keys for APT use. Change-Id: I6b205a2bb61207d1549222ba5501536b2743df77 --- docker/base/Dockerfile.j2 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'docker') diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 5d305411d..ab1ee93ce 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -268,7 +268,7 @@ COPY dpkg_reducing_disk_footprint /etc/dpkg/dpkg.cfg.d/dpkg_reducing_disk_footpr # Need apt-transport-https and ca-certificates before replacing sources.list or # apt-get update will not work if any repositories are accessed via HTTPS RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-transport-https ca-certificates gnupg dirmngr \ + && apt-get -y install --no-install-recommends apt-transport-https ca-certificates gnupg dirmngr curl \ && apt-get clean {% endblock %} @@ -326,6 +326,8 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences '901F9177AB97ACBE', 'A20F259AEB9C94BB' ] %} + {% set remote_apt_keys = [ + ] %} {% elif base_distro == 'debian' %} {% set base_apt_keys = [ '58118E89F3A912897C070ADBF76221572C52609D', @@ -336,6 +338,8 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences '901F9177AB97ACBE', 'E84AC2C0460F3994', ] %} + {% set remote_apt_keys = [ + ] %} {% set base_apt_packages = base_apt_packages + ['sudo',] %} @@ -343,11 +347,16 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences {% block base_ubuntu_package_installation %} {%- block base_ubuntu_package_key_installation %} - {%- for key in base_apt_keys | customizable('apt_keys') %} + {% for key in base_apt_keys | customizable('apt_keys') %} {%- if loop.first %}RUN {% else %} && {% endif %}apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 {{ key }} {%- if not loop.last %} \ {% endif -%} {% endfor %} + {% for key in remote_apt_keys | customizable('remote_apt_keys') %} + {%- if loop.first %} RUN {% else %} && {% endif %}curl {{ key }} | apt-key add - + {%- if not loop.last %} \ + {% endif -%} + {% endfor %} {% endblock %} RUN apt-get update \ && apt-get -y upgrade \ -- cgit v1.2.3