From a487bded92b404f9a91f7abc9a338900fc806d9b Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Fri, 11 Mar 2022 12:06:36 +0300 Subject: [PATCH] Use BuildKit for all images BuildKit offers much shorter build times --- ue4docker/infrastructure/ImageBuilder.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ue4docker/infrastructure/ImageBuilder.py b/ue4docker/infrastructure/ImageBuilder.py index 1253cf50..a7534e1b 100644 --- a/ue4docker/infrastructure/ImageBuilder.py +++ b/ue4docker/infrastructure/ImageBuilder.py @@ -71,7 +71,7 @@ def build(self, name, tags, args, secrets=None): # Determine whether we are building using `docker buildx` with build secrets imageTags = self._formatTags(name, tags) command = DockerUtils.build(imageTags, self.context(name), args) - env = None + if self.platform == "linux" and secrets is not None and len(secrets) > 0: # Create temporary files to store the contents of each of our secrets @@ -85,10 +85,16 @@ def build(self, name, tags, args, secrets=None): command = DockerUtils.buildx( imageTags, self.context(name), args, secretFlags ) - env = {"DOCKER_BUILDKIT": "1"} # Build the image if it doesn't already exist - self._processImage(imageTags[0], name, command, "build", "built", env=env) + self._processImage( + imageTags[0], + name, + command, + "build", + "built", + env={"DOCKER_BUILDKIT": "1"}, + ) def context(self, name): """