f74cd0ecb8
This refactor organizes the code as follows: If RPM family: execute YUM repo setup if binary install binary tools if source install source tools IF DEB family: install source tools I have tested building and everything seems fairly solid except possilby RHOS. The long term goal of this patch is to allow us to add our own repos in the "execute YUM repo setup" section of the base file based upon OpenStack Infrastructure YUM repos. Partially-Implements: blueprint rhel-based-image-support Change-Id: I759fb8fc050973460c9c69bb500de68e88a68b3b
274 lines
8.3 KiB
Django/Jinja
274 lines
8.3 KiB
Django/Jinja
FROM {{ base_distro }}:{{ base_distro_tag }}
|
|
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
|
|
|
# Early failure for bases and types
|
|
{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
|
|
{% if install_type not in ['source', 'binary', 'rdo', 'rhel'] %}
|
|
|
|
RUN echo 'ERROR: {{ install_type }} is unavailable for {{ base_distro }}' \
|
|
&& /bin/false
|
|
|
|
{% endif %}
|
|
{% elif base_distro in ['ubuntu', 'debian'] %}
|
|
{% if install_type not in ['source'] %}
|
|
|
|
RUN echo 'ERROR: {{ install_type }} is unavailable for {{ base_distro }}' \
|
|
&& /bin/false
|
|
|
|
{% endif %}
|
|
{% else %}
|
|
|
|
RUN echo 'ERROR: The specified distro has no Kolla images to build: "{{ base_distro }}"' \
|
|
&& /bin/false
|
|
|
|
{% endif %}
|
|
|
|
|
|
{{ include_header }}
|
|
|
|
ENV KOLLA_BASE_DISTRO {{ base_distro }}
|
|
ENV KOLLA_INSTALL_TYPE {{ install_type }}
|
|
ENV KOLLA_INSTALL_METATYPE {{ install_metatype }}
|
|
|
|
# For RPM Variants, enable the correct repositories - this should all be done
|
|
# in the base image so repos are consistent throughout the system. This also
|
|
# enables to provide repo overrides at a later date in a simple fashion if we
|
|
# desire such functionality. I think we will :)
|
|
|
|
{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
|
|
|
|
#### BEGIN REPO ENABLEMENT
|
|
|
|
# Turns on MariaDB repos throughout the RPM 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_metatype == 'rdo' %}
|
|
|
|
# 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
|
|
RUN curl http://trunk.rdoproject.org/centos7/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo
|
|
|
|
{% endif %}
|
|
# endif for repo setup for all RHEL except RHEL OSP
|
|
|
|
{% if install_metatype == 'rhos' %}
|
|
|
|
# Turn on the RHOS 7.0 repo for RHOS
|
|
RUN subscription-manager repos --enable rhel-7-server-rpms \
|
|
&& subscription-manager repos --enable rhel-7-server-openstack-7.0-rpms
|
|
|
|
{% endif %}
|
|
|
|
{% 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 install -y epel-release \
|
|
&& yum clean all
|
|
|
|
{% endif %}
|
|
# Endif for base_distro centos
|
|
|
|
{% if base_distro == 'rhel' %}
|
|
|
|
# Enable couple required repositories for all RHEL builds
|
|
# Turn on EPEL throughout the build
|
|
RUN yum install -y \
|
|
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
|
|
&& yum clean all \
|
|
&& subscription-manager repos --enable rhel-7-server-optional-rpms \
|
|
&& subscription-manager repos --enable rhel-7-server-extras-rpms
|
|
|
|
{% endif %}
|
|
# Endif for base_distro RHEL
|
|
|
|
{% 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 oraclelinux
|
|
|
|
{% if 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
|
|
|
|
{% endif %}
|
|
# Endif for base_distro fedora
|
|
|
|
#### END REPO ENABLEMENT
|
|
|
|
# We are back to the basic if conditional here which is:
|
|
# if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel']
|
|
|
|
RUN yum update -y \
|
|
&& yum clean all
|
|
|
|
{% if install_type == 'binary' %}
|
|
|
|
# Install base packages
|
|
RUN yum install -y \
|
|
git \
|
|
iproute \
|
|
mariadb-libs \
|
|
MySQL-python \
|
|
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-openstackclient \
|
|
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 \
|
|
sudo \
|
|
which \
|
|
&& yum clean all
|
|
|
|
{% endif %}
|
|
# Endif for install_type binary
|
|
|
|
{% if install_type == 'source' %}
|
|
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
|
|
|
# Set up repositories
|
|
RUN yum install -y https://rdo.fedorapeople.org/rdo-release.rpm \
|
|
&& yum clean all
|
|
|
|
{% endif %}
|
|
|
|
# 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 \
|
|
openldap-devel \
|
|
openssl \
|
|
openssl-devel \
|
|
postgresql \
|
|
postgresql-devel \
|
|
python-devel \
|
|
sqlite-devel \
|
|
sudo \
|
|
tar \
|
|
which \
|
|
&& yum clean all
|
|
|
|
{% endif %}
|
|
# endif for install type is binary/rhos/rdo for RPM based distros
|
|
# endif for base_distro centos,fedora,oraclelinux,rhel
|
|
{% 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 430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A \
|
|
&& apt-get update \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get dist-upgrade -y \
|
|
&& apt-get install -y --no-install-recommends python \
|
|
&& 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 %}
|
|
|
|
COPY set_configs.py kolla-common.sh /opt/kolla/
|