Allow changing base image

By changing the PREFIX variable in the .buildconf one is now able to
build docker images from different bases.

For example, add the following line to your .buildconf file to build
CentOS based images:

    PREFIX=centos-rdo-

Default base image is Fedora. For now only RH family is supported.

Additionally, changing the namespace either with the NAMESPACE variable
in .buildconf or via --namespace commandline option now changes the
source namespace as well from the default kollaglue one.

Implements: blueprint multi-baseos
Co-Authored-By: Steven Dake <stdake@cisco.com>
Change-Id: I3964cd2292789ea883a1f2d2738a5731a4fff49b
This commit is contained in:
Martin André 2015-02-26 15:00:42 +09:00
parent 5052e54f45
commit 0764fd7dea
42 changed files with 65 additions and 57 deletions

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-alarm && yum clean all RUN yum install -y openstack-ceilometer-alarm && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-api && yum clean all RUN yum install -y openstack-ceilometer-api && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN mkdir -p /opt/kolla RUN mkdir -p /opt/kolla

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-central && yum clean all RUN yum install -y openstack-ceilometer-central && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-collector && yum clean all RUN yum install -y openstack-ceilometer-collector && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-compute python-ceilometerclient python-pecan \ RUN yum install -y openstack-ceilometer-compute python-ceilometerclient python-pecan \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-ceilometer-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%ceilometer-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-notification && yum clean all RUN yum install -y openstack-ceilometer-notification && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-cinder && yum clean all RUN yum -y install openstack-cinder && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-glance-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%glance-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
VOLUME /var/lib/glance VOLUME /var/lib/glance

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-glance ; yum clean all RUN yum -y install openstack-glance ; yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-glance-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%glance-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-heat-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%heat-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# TODO: configure cfn and cloudwatch # TODO: configure cfn and cloudwatch

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN mkdir -p /opt/kolla RUN mkdir -p /opt/kolla

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-heat-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%heat-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \ RUN yum -y install \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \ RUN yum -y install \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
#Install required packages #Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install mariadb-galera-server; yum clean all RUN yum -y install mariadb-galera-server; yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install mongodb mongodb-server; yum clean all RUN yum -y install mongodb mongodb-server; yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-neutron-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-neutron-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-neutron-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-neutron-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-neutron-ml2 ; yum clean all RUN yum -y install openstack-neutron-ml2 ; yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-neutron-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%neutron-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
#Install required packages #Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-nova-common \ RUN yum -y install openstack-nova-common \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-nova-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-nova-compute \ RUN yum -y install openstack-nova-compute \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install libvirt-daemon-driver-* libvirt-daemon libvirt-daemon-kvm qemu-kvm && yum clean all RUN yum -y install libvirt-daemon-driver-* libvirt-daemon libvirt-daemon-kvm qemu-kvm && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-nova-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-nova-network \ RUN yum -y install openstack-nova-network \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-nova-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \ RUN yum -y install \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-nova-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \ RUN yum -y install \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-nova-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%nova-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \ RUN yum -y install \

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Install required packages # Install required packages

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-swift-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install openstack-utils openstack-swift && yum clean all RUN yum -y install openstack-utils openstack-swift && yum clean all

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-swift-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-swift-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-swift-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%swift-base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
ADD ./start.sh /start.sh ADD ./start.sh /start.sh

View File

@ -1,4 +1,4 @@
FROM kollaglue/fedora-rdo-base FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN curl -O https://repos.fedorapeople.org/repos/openstack/openstack-juno/fedora-21/openstack-zaqar-2014.2-1.fc22.noarch.rpm RUN curl -O https://repos.fedorapeople.org/repos/openstack/openstack-juno/fedora-21/openstack-zaqar-2014.2-1.fc22.noarch.rpm

View File

@ -37,21 +37,6 @@ commands:
$ docker run kollaglue/fedora-rdo-keystone:76a1602 $ docker run kollaglue/fedora-rdo-keystone:76a1602
Or in your kubernetes configurations:
"containers": [{
"name": "keystone",
"image": "kollaglue/fedora-rdo-keystone:76a1602",
"ports": [
{"containerPort": 5000},
{"containerPort": 35357}
],
"env": [
{"name": "DB_ROOT_PASSWORD", "value": "password"},
{"name": "KEYSTONE_ADMIN_TOKEN", "value": "ADMINTOKEN"}
]
}]
## Building releases ## Building releases
To build into the `latest` tag, add `--release`: To build into the `latest` tag, add `--release`:
@ -62,14 +47,31 @@ Or to build and push:
$ ./build --push --release $ ./build --push --release
## Build all images at once
The `build-all-docker-images` script in the tools directory is a wrapper for
the `build-docker-image` that builds all images, as the name suggests, in the
correct order. It responds to the same options as `build-docker-image` with the
additional `--from` and `--to` options that allows building only images that
have changed between the specified git revisions.
For example, to build all images contained in docker directory and push new release:
$ tools/build-all-docker-images --release --push
To build only images modified in test-branch along with their children:
$ tools/build-all-docker-images --from master --to test-branch
## Configuration ## Configuration
The `build-docker-image` script will look for a file named `.buildconf` The `build-docker-image` script will look for a file named `.buildconf`
in your current directory and in the top level of the repository. You in the image directory and in the top level of the repository. You
can use this to set defaults, such as: can use this to set defaults, such as:
NAMESPACE=larsks NAMESPACE=larsks
PREFIX=centos-rdo-
This setting would cause all images to be tagged into the `larsks/` This setting would cause images to be tagged into the `larsks/`
namespace. namespace and use CentOS as base image instead of the default Fedora.

View File

@ -70,6 +70,8 @@ function init_image {
local image="${NAMESPACE:+${NAMESPACE}/}${PREFIX}${img_dir##*/}" local image="${NAMESPACE:+${NAMESPACE}/}${PREFIX}${img_dir##*/}"
local base_image=$(cat $img_dir/Dockerfile | gawk 'match($0, /^\s*FROM\s+(\S+)/, matches) {print matches[1]}' ) local base_image=$(cat $img_dir/Dockerfile | gawk 'match($0, /^\s*FROM\s+(\S+)/, matches) {print matches[1]}' )
base_image=${base_image//%%KOLLA_NAMESPACE%%/$NAMESPACE}
base_image=${base_image//%%KOLLA_PREFIX%%/$PREFIX}
img_dirs[$image]=$img_dir img_dirs[$image]=$img_dir
dependency[$image]=$base_image dependency[$image]=$base_image

View File

@ -90,6 +90,10 @@ fi
TMPDIR=$(mktemp -d /tmp/output.XXXXXXXXXX) TMPDIR=$(mktemp -d /tmp/output.XXXXXXXXXX)
cp -aL $IMGDIR/* $TMPDIR cp -aL $IMGDIR/* $TMPDIR
# Use an extension for in-place editing for portability, as GNU and BSD
# versions of sed behave differently otherwise
sed -i.bak "s/%%KOLLA_NAMESPACE%%/${NAMESPACE}/g" $TMPDIR/Dockerfile
sed -i.bak "s/%%KOLLA_PREFIX%%/${PREFIX}/g" $TMPDIR/Dockerfile
if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then
echo "ERROR: failed to build $FULLIMAGE" echo "ERROR: failed to build $FULLIMAGE"