From 168960a1553a4248d9aa16155d8841ab97f790b9 Mon Sep 17 00:00:00 2001 From: Marat Radchenko Date: Wed, 22 Nov 2023 19:00:08 +0300 Subject: [PATCH] Add `--docker-build-args` option to passthrough `docker build` arguments --- docs/ue4-docker-build.adoc | 4 ++++ src/ue4docker/build.py | 2 +- src/ue4docker/infrastructure/BuildConfiguration.py | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/ue4-docker-build.adoc b/docs/ue4-docker-build.adoc index 59fec735..092f249c 100644 --- a/docs/ue4-docker-build.adoc +++ b/docs/ue4-docker-build.adoc @@ -46,6 +46,10 @@ Combine generated Dockerfiles into a single multi-stage build Dockerfile *-conan-ue4cli* _conan_ue4cli_:: Override the default version of conan-ue4cli installed in the ue4-full image +*--docker-build-args*:: +Allows passing custom args to `docker build` command. +For example, this can be useful for pushing images. + *--dry-run*:: Use this if you would like to see what Docker commands would be run by `ue4-docker build` without actually building anything. Execution will proceed as normal, but no Git credentials will be requested and all Docker commands will be printed to standard output instead of being executed as child processes. diff --git a/src/ue4docker/build.py b/src/ue4docker/build.py index 19a9bf4c..bd8c054b 100644 --- a/src/ue4docker/build.py +++ b/src/ue4docker/build.py @@ -359,7 +359,7 @@ def build(): commonArgs = [ "--build-arg", "NAMESPACE={}".format(GlobalConfiguration.getTagNamespace()), - ] + ] + config.args.docker_build_args # Build the UE4 build prerequisites image if config.buildTargets["build-prerequisites"]: diff --git a/src/ue4docker/infrastructure/BuildConfiguration.py b/src/ue4docker/infrastructure/BuildConfiguration.py index 62cc1d59..c6bd5630 100644 --- a/src/ue4docker/infrastructure/BuildConfiguration.py +++ b/src/ue4docker/infrastructure/BuildConfiguration.py @@ -149,6 +149,12 @@ def addArguments(parser): action="store_true", help="Use a random memory limit for Windows containers", ) + parser.add_argument( + "--docker-build-args", + action="append", + default=[], + help="Specify additional options for 'docker build' commands" + ) parser.add_argument( "--exclude", action="append",