Support a custom base image

Add a new option(base-image) to support custom base image
In default, the base-image is equal to base. When using custom
image, please use command line like:

    ./tool/build.py --base-image my-image --base centos --base-tag 0.1

DocImpact

Closes-Bug: #1573544
Change-Id: If4b9c57a2b68f6f06d3e981f30b2173064e02193
This commit is contained in:
Jeffrey Zhang 2016-05-06 17:30:47 +08:00
parent fcdf187337
commit 070bf25835
3 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
FROM {{ base_distro }}:{{ base_distro_tag }}
FROM {{ base_image }}:{{ base_distro_tag }}
MAINTAINER {{ maintainer }}
LABEL kolla_version="{{ kolla_version }}"

View File

@ -479,6 +479,7 @@ class KollaWorker(object):
loader=jinja2.FileSystemLoader(path))
template = env.get_template(template_name)
values = {'base_distro': self.base,
'base_image': self.conf.base_image,
'base_distro_tag': self.base_tag,
'install_metatype': self.install_metatype,
'image_prefix': self.image_prefix,

View File

@ -56,10 +56,12 @@ _CLI_OPTS = [
cfg.StrOpt('base', short='b', default='centos',
choices=BASE_OS_DISTRO,
deprecated_group='kolla-build',
help='The base distro to use when building'),
help='The distro type of the base image'),
cfg.StrOpt('base-tag', default='latest',
deprecated_group='kolla-build',
help='The base distro image tag'),
cfg.StrOpt('base-image', default=None,
help='The base image name. Default is the same with base'),
cfg.BoolOpt('debug', short='d', default=False,
deprecated_group='kolla-build',
help='Turn on debugging log level'),
@ -288,3 +290,5 @@ def parse(conf, args, usage=None, prog=None,
prog=prog,
version=version.cached_version_string(),
default_config_files=default_config_files)
if not conf.base_image:
conf.base_image = conf.base