From cbd42ca6e90cca2ff4b84f5e4e46224e6455e8b2 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Fri, 28 Aug 2015 12:16:53 +0000 Subject: Move docker_templates to docker dir Updated build.py to reflect this change. Deprecate --template option and make it a noop. Change-Id: I7cd98d1ee684a4c64984a49597159868152683b2 Partially-Implements: blueprint remove-docker-dir --- docker/base/Dockerfile.j2 | 236 +++++++++++++++++++++++++++++++++++++++++++ docker/base/kolla-common.sh | 22 ++++ docker/base/mariadb.yum.repo | 5 + docker/base/sources.list | 22 ++++ 4 files changed, 285 insertions(+) create mode 100755 docker/base/Dockerfile.j2 create mode 100644 docker/base/kolla-common.sh create mode 100644 docker/base/mariadb.yum.repo create mode 100644 docker/base/sources.list (limited to 'docker/base') diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 new file mode 100755 index 000000000..b3b0c776a --- /dev/null +++ b/docker/base/Dockerfile.j2 @@ -0,0 +1,236 @@ +FROM {{ base_distro }}:{{ base_distro_tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{{ include_header }} + +ENV KOLLA_BASE_DISTRO {{ base_distro }} +ENV KOLLA_INSTALL_TYPE {{ install_type }} + +{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +# Turns on galera repos throughout the build +COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo + +RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm \ + && sed -i 's|$releasever|centos/latest|g' /etc/yum.repos.d/percona-release.repo + + {% if install_type == 'binary' %} + {% if base_distro in ['centos', 'oraclelinux'] %} + +# Set up repositories +# This repository provides all dependencies used by RDO OpenStack +RUN yum install -y https://rdoproject.org/repos/openstack-kilo/rdo-release-kilo.rpm + +# This repository provides latest packages built from trunk master into RPMs +RUN curl http://trunk.rdoproject.org/centos7/current/delorean.repo -o /etc/yum.repos.d/delorean-current.repo + +# This repository turns off auth in PAM so we can operate on Ubuntu 14.04 +RUN curl https://copr.fedoraproject.org/coprs/sdake/pam.noaudit/repo/epel-7/sdake-pam.noaudit-epel-7.repo -o /etc/yum.repos.d/sdake-pam.noaudit-epel-7.repo + +{% if base_distro == 'centos' %} +# CentOS 7.1 workaround for conflicting packages with libvirt +RUN rpm -e --nodeps systemd-container systemd-container-libs \ + && rpm -e --nodeps yum-plugin-fastestmirror \ + && yum -d 10 -y install systemd systemd-libs systemd-devel \ + && yum clean all +{% endif %} + +{% if base_distro == 'oraclelinux' %} +RUN yum install -y \ + yum-utils \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ + && yum clean all +RUN yum-config-manager --enable ol7_optional_latest ol7_addons +{% endif %} + + # Endif for base_distro centos/oraclelinux + {% elif base_distro == 'fedora' %} + +# Set up repositories +RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm \ + && yum -y install dnf dnf-plugins-core \ + && yum clean all \ + && dnf copr enable -y sdake/pam.noaudit + + # Endif for base_distro fedora + {% endif %} + +# Update packages +RUN yum update -y \ + && yum install -y epel-release \ + && yum clean all + +# Install base packages +RUN yum install -y \ + git \ + iproute \ + mariadb-libs \ + openssl \ + openstack-utils \ + pyparsing \ + python-alembic \ + python-amqp \ + python-amqplib \ + python-anyjson \ + python-boto \ + python-cheetah \ + python-cliff \ + python-cmd2 \ + python-croniter \ + python-crypto \ + python-d2to1 \ + python-docutils \ + python-dogpile-cache \ + python-dogpile-core \ + python-empy \ + python-eventlet \ + python-flask \ + python-futures \ + python-greenlet \ + python-httplib2 \ + python-iso8601 \ + python-itsdangerous \ + python-jinja2 \ + python-jsonpatch \ + python-jsonpath-rw \ + python-jsonpointer \ + python-jsonschema \ + python-keyring \ + python-kombu \ + python-ldap \ + python-lesscpy \ + python-lockfile \ + python-lxml \ + python-markdown \ + python-memcached \ + python-migrate \ + python-msgpack \ + python-netifaces \ + python-networkx \ + python-oauthlib \ + python-oslo-config \ + python-oslo-messaging \ + python-oslo-rootwrap \ + python-oslo-policy \ + python-paramiko \ + python-passlib \ + python-paste-deploy \ + python-pbr \ + python-pecan \ + python-pip \ + python-ply \ + python-prettytable \ + python-psutil \ + python-pycadf \ + python-pygments \ + python-pymongo \ + python-qpid \ + python-repoze-lru \ + python-requests \ + python-routes \ + python-simplegeneric \ + python-simplejson \ + python-singledispatch \ + python-six \ + python-sqlalchemy \ + python-stevedore \ + python-taskflow \ + python-versiontools \ + python-warlock \ + python-webob \ + python-websockify \ + python-webtest \ + python-werkzeug \ + python-wsme \ + && yum clean all + +# TODO(inc0): when oslo_service lands in delorean, change pip to yum +# necessary until https://bugzilla.redhat.com/show_bug.cgi?id=1229477 is fixed + +# This is dirty like zebra. This works around a bug in Ubuntu 14.04 LTS. The +# --net=host option does not work on ubuntu 14.04 because of a kernel bug. One +# workaround is to buid pam without authentication. +# See: +# https://registry.hub.docker.com/u/sequenceiq/pam/ +# +RUN rpm -e --nodeps pam \ + && yum -y install pam+noaudit \ + && yum clean all +# End dirty like zebra + + # Endif for install_type binary + {% elif install_type == 'source' %} + +# Update packages +RUN yum update -y \ + && yum install -y \ + epel-release \ + gcc \ + gcc-c++ \ + git \ + libffi-devel \ + libxml2-devel \ + libxslt-devel \ + mariadb-devel \ + mysql-devel \ + MySQL-python \ + openldap-devel \ + openssl \ + openssl-devel \ + postgresql \ + postgresql-devel \ + python-devel \ + python-oslo-policy \ + sqlite-devel \ + tar \ + && yum clean all + + # Endif for install_type source + {% endif %} + +# Endif for base_distro centos,fedora,oraclelinux +{% elif base_distro in ['ubuntu', 'debian'] %} + +# This will prevent questions from being asked during the install +ENV DEBIAN_FRONTEND noninteractive + +COPY sources.list /etc/apt/ + +RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com 199369E5404BD5FC7D2FE43BCBCB082A1BB943DB \ + && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com 391A9AA2147192839E9DB0315EDB1B62EC4926EA \ + && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com F78372A06FF50C80464FC1B4F7B8CEA6056E8E56 \ + && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A \ + && apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com 7D5C473EB80C00FC133071068A6844A29F68104E \ + && apt-get update \ + && apt-get upgrade -y \ + && apt-get dist-upgrade -y \ + && apt-get install -y --no-install-recommends \ + curl \ + ca-certificates \ + build-essential \ + python-dev \ + libssl-dev \ + python-mysqldb \ + libmariadbclient-dev \ + libxslt1-dev \ + libffi-dev \ + libyaml-dev \ + pkg-config \ + && 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 \ + && rm -rf /usr/lib/python2.7/site-packages \ + && ln -s dist-packages /usr/lib/python2.7/site-packages + +# Endif for base_distro ubuntu,debian +{% endif %} + +{% if install_type == 'source' %} + +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python get-pip.py \ + && rm get-pip.py + +# Endif for install_type source +{% endif %} + +COPY kolla-common.sh /opt/kolla/ diff --git a/docker/base/kolla-common.sh b/docker/base/kolla-common.sh new file mode 100644 index 000000000..cc960ca24 --- /dev/null +++ b/docker/base/kolla-common.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set_configs() { + case $KOLLA_CONFIG_STRATEGY in + COPY_ALWAYS) + source /opt/kolla/config-external.sh + ;; + COPY_ONCE) + if [[ -f /configured ]]; then + echo 'INFO - This container has already been configured; Refusing to copy new configs' + else + source /opt/kolla/config-external.sh + touch /configured + fi + ;; + + *) + echo '$KOLLA_CONFIG_STRATEGY is not set properly' + exit 1 + ;; + esac +} diff --git a/docker/base/mariadb.yum.repo b/docker/base/mariadb.yum.repo new file mode 100644 index 000000000..564ce3f0e --- /dev/null +++ b/docker/base/mariadb.yum.repo @@ -0,0 +1,5 @@ +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.0/centos7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 diff --git a/docker/base/sources.list b/docker/base/sources.list new file mode 100644 index 000000000..ccb6f8d25 --- /dev/null +++ b/docker/base/sources.list @@ -0,0 +1,22 @@ +# 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 explictly installed to be used +deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse + +# TODO(SamYaple): Switch this to the Liberty repo as soon as the update packages +# and actually start signing them. +# We need to add the Kilo 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/kilo 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 + +# RabbitMQ repo. Despite the name, the 'testing' repo is the stable repo. +deb http://www.rabbitmq.com/debian/ testing main -- cgit v1.2.3