From 30c805596f34fe8652875afdce57c4db31c0e032 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Sat, 5 Mar 2016 21:24:27 +0100 Subject: [PATCH] Use debian repos for debian base docker image Change-Id: Ic5c1d20fa9f7f1cd9fd20e658b4bd1abb235f3b6 Partially-implements: blueprint build-debian --- docker/base/Dockerfile.j2 | 62 +++++++++++++------ docker/base/apt_preferences.debian | 23 +++++++ ...apt_preferences => apt_preferences.ubuntu} | 0 docker/base/sources.list.debian | 26 ++++++++ .../{sources.list => sources.list.ubuntu} | 0 5 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 docker/base/apt_preferences.debian rename docker/base/{apt_preferences => apt_preferences.ubuntu} (100%) create mode 100644 docker/base/sources.list.debian rename docker/base/{sources.list => sources.list.ubuntu} (100%) diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 84a4fd3749..c555b95c68 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -193,29 +193,55 @@ RUN cat /tmp/kolla_bashrc >> /etc/bash.bashrc # This will prevent questions from being asked during the install ENV DEBIAN_FRONTEND noninteractive -COPY sources.list /etc/apt/ -COPY apt_preferences /etc/apt/preferences +COPY sources.list.{{ base_distro }} /etc/apt/sources.list +COPY apt_preferences.{{ base_distro }} /etc/apt/preferences -RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 199369E5404BD5FC7D2FE43BCBCB082A1BB943DB \ - && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 391A9AA2147192839E9DB0315EDB1B62EC4926EA \ - && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A \ - && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 08B73419AC32B4E966C1A330E84AC2C0460F3994 \ - && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 46095ACC8548582C1A2699A9D27D666CD88E42B4 \ +{% set packages = '\ + ca-certificates \ + curl \ + lvm2 \ + open-iscsi \ + python \ + tgt' +%} + +{% if base_distro == 'ubuntu' %} + {% set keys = [ + '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB', + '391A9AA2147192839E9DB0315EDB1B62EC4926EA', + '430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A', + '08B73419AC32B4E966C1A330E84AC2C0460F3994', + '46095ACC8548582C1A2699A9D27D666CD88E42B4', + ] %} +{% elif base_distro == 'debian' %} + {% set keys = [ + '08B73419AC32B4E966C1A330E84AC2C0460F3994', + '58118E89F3A912897C070ADBF76221572C52609D', + '0xcbcb082a1bb943db', + 'D27D666CD88E42B4', + ] %} + {% set packages = packages + + ' sudo' + %} +{% endif %} + +RUN true \ + {% for key in keys %} + && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 {{ key }} \ + {% endfor %} && apt-get update \ - && apt-get upgrade -y \ - && apt-get dist-upgrade -y \ - && apt-get -y install --no-install-recommends \ - ca-certificates \ - python \ - curl \ - open-iscsi \ - tgt \ - lvm2 \ - && apt-get clean \ - && sed -i "s|'purelib': '\$base/local/lib/python\$py_version_short/dist-packages',|'purelib': '\$base/lib/python\$py_version_short/dist-packages',|;s|'platlib': '\$platbase/local/lib/python\$py_version_short/dist-packages',|'platlib': '\$platbase/lib/python\$py_version_short/dist-packages',|;s|'headers': '\$base/local/include/python\$py_version_short/\$dist_name',|'headers': '\$base/include/python\$py_version_short/\$dist_name',|;s|'scripts': '\$base/local/bin',|'scripts': '\$base/bin',|;s|'data' : '\$base/local',|'data' : '\$base',|" /usr/lib/python2.7/distutils/command/install.py \ + && apt-get -y upgrade \ + && apt-get -y dist-upgrade \ + && apt-get -y install --no-install-recommends {{ packages }} \ + && apt-get clean + +{% if base_distro == 'ubuntu' %} +RUN sed -i "s|'purelib': '\$base/local/lib/python\$py_version_short/dist-packages',|'purelib': '\$base/lib/python\$py_version_short/dist-packages',|;s|'platlib': '\$platbase/local/lib/python\$py_version_short/dist-packages',|'platlib': '\$platbase/lib/python\$py_version_short/dist-packages',|;s|'headers': '\$base/local/include/python\$py_version_short/\$dist_name',|'headers': '\$base/include/python\$py_version_short/\$dist_name',|;s|'scripts': '\$base/local/bin',|'scripts': '\$base/bin',|;s|'data' : '\$base/local',|'data' : '\$base',|" /usr/lib/python2.7/distutils/command/install.py \ && rm -rf /usr/lib/python2.7/site-packages \ && ln -s dist-packages /usr/lib/python2.7/site-packages +{% endif %} +{# endif for base_distro ubuntu, debian #} {% endif %} COPY set_configs.py /usr/local/bin/kolla_set_configs diff --git a/docker/base/apt_preferences.debian b/docker/base/apt_preferences.debian new file mode 100644 index 0000000000..1aa14b1d83 --- /dev/null +++ b/docker/base/apt_preferences.debian @@ -0,0 +1,23 @@ +Package: * +Pin: origin "download.ceph.com" +Pin-Priority: 500 + +Package: * +Pin: origin "nyc2.mirrors.digitalocean.com" +Pin-Priority: 500 + +Package: python-rtslib +Pin: release o=Debian,a=testing,n=stretch,l=Debian +Pin-Priority: 500 + +Package: targetcli +Pin: release o=Debian,a=testing,n=stretch,l=Debian +Pin-Priority: 500 + +Package: python-configshell +Pin: release o=Debian,a=testing,n=stretch,l=Debian +Pin-Priority: 500 + +Package: * +Pin: release o=Debian,a=testing,n=stretch,l=Debian +Pin-Priority: -1 diff --git a/docker/base/apt_preferences b/docker/base/apt_preferences.ubuntu similarity index 100% rename from docker/base/apt_preferences rename to docker/base/apt_preferences.ubuntu diff --git a/docker/base/sources.list.debian b/docker/base/sources.list.debian new file mode 100644 index 0000000000..d247dc434c --- /dev/null +++ b/docker/base/sources.list.debian @@ -0,0 +1,26 @@ +# Default repos +deb http://httpredir.debian.org/debian jessie main + +# jessie-backports +deb http://httpredir.debian.org/debian jessie-backports main contrib + +# jessie-updates, previously known as 'volatile' +deb http://httpredir.debian.org/debian jessie-updates main + +# debian security updates +deb http://security.debian.org jessie/updates main + +# need some packages from testing not available in stable +deb http://httpredir.debian.org/debian stretch main + +# Ceph repo +deb http://download.ceph.com/debian-hammer/ jessie main + +# Maria DB repo +deb [arch=amd64,i386] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/debian jessie main + +# Kibana repo +deb http://packages.elastic.co/kibana/4.4/debian stable main + +# docker +deb http://apt.dockerproject.org/repo debian-jessie main diff --git a/docker/base/sources.list b/docker/base/sources.list.ubuntu similarity index 100% rename from docker/base/sources.list rename to docker/base/sources.list.ubuntu