From a80e3fb48c0fa3fb69160aa923be24b4714b5be8 Mon Sep 17 00:00:00 2001 From: jpic Date: Mon, 7 Dec 2020 11:16:31 +0100 Subject: [PATCH] Add docker daemon support --- shlax/image.py | 6 ++++-- shlax/targets/buildah.py | 13 ++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/shlax/image.py b/shlax/image.py index 45ed9ec..dc58635 100644 --- a/shlax/image.py +++ b/shlax/image.py @@ -60,9 +60,11 @@ class Image: setattr(self, k, v) # docker.io currently has issues with oci format - self.format = format or 'oci' if self.registry == 'docker.io': - self.format = 'docker' + self.backend = 'docker' + + if not self.format: + self.format = 'docker' if self.backend == 'docker' else 'oci' # filter out tags which resolved to None self.tags = [t for t in self.tags if t] diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index 6d6c45e..60617ab 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -145,8 +145,19 @@ class Buildah(Target): async def commit(self): await self.parent.exec( - f'buildah commit {self.ctr} {self.image.repository}:final' + 'buildah', + 'commit', + f'--format={self.image.format}', + self.ctr, + f'{self.image.repository}:final', ) + if self.image.backend == 'docker': + await self.parent.exec( + 'buildah', + 'push', + f'{self.image.repository}:final', + f'docker-daemon:{self.image.repository}:latest' + ) ENV_TAGS = ( # gitlab