aboutsummaryrefslogtreecommitdiff
path: root/docker/base
diff options
context:
space:
mode:
authorEdmund Rhudy <erhudy@bloomberg.net>2017-01-12 13:58:44 -0500
committerEdmund Rhudy <erhudy@bloomberg.net>2017-01-17 11:16:37 -0500
commit74249cc12892ff2daf8420f643d8abfa3e8c8356 (patch)
treedab34fcfac6e8dd942cdb3b613eeb9d4ee350778 /docker/base
parentbff91aecd996a7aa3def31f6365c033ef3141a1d (diff)
downloadkolla-74249cc12892ff2daf8420f643d8abfa3e8c8356.tar.gz
kolla-74249cc12892ff2daf8420f643d8abfa3e8c8356.zip
Add blocks for Ubuntu apt setup and package installation
This adds additional blocks in the base image dockerfile to enable overriding additional sections, as well as doing so in a more fine-grained manner. The main use case here is being able to do Internet-isolated builds of Ubuntu-based Docker images. Change-Id: I9842895a898f6798becc6177aabdf8deffead611 Closes-Bug: #1656069
Diffstat (limited to 'docker/base')
-rw-r--r--docker/base/Dockerfile.j224
1 files changed, 17 insertions, 7 deletions
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index 9fbde0f1c..38b9679d1 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -207,13 +207,21 @@ ENV DEBIAN_FRONTEND noninteractive
# Reducing disk footprint
COPY dpkg_reducing_disk_footprint /etc/dpkg/dpkg.cfg.d/dpkg_reducing_disk_footprint
-# Need apt-transport-https BEFORE we replace sources.list or apt-get update wont work!
+{% block base_ubuntu_package_pre %}
+# 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 \
&& apt-get clean
+{% endblock %}
+{% block base_ubuntu_package_sources_list %}
COPY sources.list.{{ base_distro }} /etc/apt/sources.list
+{% endblock %}
+
+{% block base_ubuntu_package_apt_preferences %}
COPY apt_preferences.{{ base_distro }} /etc/apt/preferences
+{% endblock %}
{% set base_apt_packages = [
'apt-utils',
@@ -257,12 +265,14 @@ COPY apt_preferences.{{ base_distro }} /etc/apt/preferences
{% endif %}
{% block base_ubuntu_package_installation %}
-{%- 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 }} \
-{% endfor -%}
-{%- if base_apt_keys|length ==0 %}RUN {% else %} && {% endif -%}
- apt-get update \
+ {%- block base_ubuntu_package_key_installation %}
+ {%- 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 %}
+ {% endblock %}
+RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
&& apt-get -y install --no-install-recommends \