diff options
| -rwxr-xr-x | kolla/common/config.py | 3 | ||||
| -rwxr-xr-x | kolla/image/build.py | 16 | ||||
| -rw-r--r-- | releasenotes/notes/additional-docker-dir-7121c33da7eec160.yaml | 6 |
3 files changed, 24 insertions, 1 deletions
diff --git a/kolla/common/config.py b/kolla/common/config.py index 47b45d62e..c2eebd294 100755 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -250,6 +250,9 @@ _CLI_OPTS = [ help='Time in seconds after which any operation times out'), cfg.MultiOpt('template-override', types.String(), help='Path to template override file'), + cfg.MultiOpt('docker-dir', types.String(), + help='Path to additional docker file template directory', + short='D', default=[]), cfg.StrOpt('logs-dir', help='Path to logs directory'), cfg.BoolOpt('pull', default=True, help='Attempt to pull a newer version of the base image'), diff --git a/kolla/image/build.py b/kolla/image/build.py index a0105b6a8..8cbefad18 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -650,6 +650,18 @@ class KollaWorker(object): os.path.join(self.working_dir, "base", "apt_preferences") ) + def copy_dir(self, src, dest): + if not os.path.isdir(dest): + shutil.copytree(src, dest) + else: + for file in os.listdir(src): + src_path = os.path.join(src, file) + dest_path = os.path.join(dest, file) + if os.path.isdir(src_path): + self.copy_dir(src_path, dest_path) + else: + shutil.copy2(src_path, dest_path) + def setup_working_dir(self): """Creates a working directory for use while building.""" if self.conf.work_dir: @@ -660,7 +672,9 @@ class KollaWorker(object): '%Y-%m-%d_%H-%M-%S_') self.temp_dir = tempfile.mkdtemp(prefix='kolla-' + ts) self.working_dir = os.path.join(self.temp_dir, 'docker') - shutil.copytree(self.images_dir, self.working_dir) + self.copy_dir(self.images_dir, self.working_dir) + for dir in self.conf.docker_dir: + self.copy_dir(dir, self.working_dir) self.copy_apt_files() LOG.debug('Created working dir: %s', self.working_dir) diff --git a/releasenotes/notes/additional-docker-dir-7121c33da7eec160.yaml b/releasenotes/notes/additional-docker-dir-7121c33da7eec160.yaml new file mode 100644 index 000000000..a3120e590 --- /dev/null +++ b/releasenotes/notes/additional-docker-dir-7121c33da7eec160.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Kolla now supports additional dockerfile directory building if they + follow Kolla template standard. To add custom docker directory run + kolla-build --docker-dir /path/to/custom/dockerfiles |
