From 30c805596f34fe8652875afdce57c4db31c0e032 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Sat, 5 Mar 2016 21:24:27 +0100 Subject: Use debian repos for debian base docker image Change-Id: Ic5c1d20fa9f7f1cd9fd20e658b4bd1abb235f3b6 Partially-implements: blueprint build-debian --- docker/base/Dockerfile.j2 | 64 +++++++++++++++++++++++++++----------- docker/base/apt_preferences | 7 ----- docker/base/apt_preferences.debian | 23 ++++++++++++++ docker/base/apt_preferences.ubuntu | 7 +++++ docker/base/sources.list | 26 ---------------- docker/base/sources.list.debian | 26 ++++++++++++++++ docker/base/sources.list.ubuntu | 26 ++++++++++++++++ 7 files changed, 127 insertions(+), 52 deletions(-) delete mode 100644 docker/base/apt_preferences create mode 100644 docker/base/apt_preferences.debian create mode 100644 docker/base/apt_preferences.ubuntu delete mode 100644 docker/base/sources.list create mode 100644 docker/base/sources.list.debian create mode 100644 docker/base/sources.list.ubuntu (limited to 'docker/base') diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 84a4fd374..c555b95c6 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 - -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 \ +COPY sources.list.{{ base_distro }} /etc/apt/sources.list +COPY apt_preferences.{{ base_distro }} /etc/apt/preferences + +{% 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 b/docker/base/apt_preferences deleted file mode 100644 index 78a74db5b..000000000 --- a/docker/base/apt_preferences +++ /dev/null @@ -1,7 +0,0 @@ -Package: * -Pin: origin download.ceph.com -Pin-Priority: 700 - -Package: mesos -Pin: version 0.27.1 -Pin-Priority: 700 diff --git a/docker/base/apt_preferences.debian b/docker/base/apt_preferences.debian new file mode 100644 index 000000000..1aa14b1d8 --- /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.ubuntu b/docker/base/apt_preferences.ubuntu new file mode 100644 index 000000000..78a74db5b --- /dev/null +++ b/docker/base/apt_preferences.ubuntu @@ -0,0 +1,7 @@ +Package: * +Pin: origin download.ceph.com +Pin-Priority: 700 + +Package: mesos +Pin: version 0.27.1 +Pin-Priority: 700 diff --git a/docker/base/sources.list b/docker/base/sources.list deleted file mode 100644 index ecc71223e..000000000 --- a/docker/base/sources.list +++ /dev/null @@ -1,26 +0,0 @@ -# Default repos -deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse -deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse -deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse - -# Backports have a lower priority and must be explicitly installed to be used -deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse - -# We need to add the Liberty repo for the updated packages they provide. The main -# ones are qemu, libvirt, and openvswitch. -deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/mitaka main - -# MariaDB 10.0 repo -deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main - -# Percona repo (for xtrabackup) -deb http://repo.percona.com/apt trusty main - -# Ceph repo -deb http://download.ceph.com/debian-hammer/ trusty main - -# Elastic repo -deb http://packages.elastic.co/elasticsearch/2.x/debian stable main - -# Kibana repo -deb http://packages.elastic.co/kibana/4.4/debian stable main diff --git a/docker/base/sources.list.debian b/docker/base/sources.list.debian new file mode 100644 index 000000000..d247dc434 --- /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.ubuntu b/docker/base/sources.list.ubuntu new file mode 100644 index 000000000..ecc71223e --- /dev/null +++ b/docker/base/sources.list.ubuntu @@ -0,0 +1,26 @@ +# Default repos +deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse +deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse +deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse + +# Backports have a lower priority and must be explicitly installed to be used +deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse + +# We need to add the Liberty repo for the updated packages they provide. The main +# ones are qemu, libvirt, and openvswitch. +deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/mitaka main + +# MariaDB 10.0 repo +deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main + +# Percona repo (for xtrabackup) +deb http://repo.percona.com/apt trusty main + +# Ceph repo +deb http://download.ceph.com/debian-hammer/ trusty main + +# Elastic repo +deb http://packages.elastic.co/elasticsearch/2.x/debian stable main + +# Kibana repo +deb http://packages.elastic.co/kibana/4.4/debian stable main -- cgit v1.2.3