Ajout drapeau pour surcharger totalement les drapeaux docker

This commit is contained in:
wpetit 2017-07-11 11:56:41 +02:00
parent 7ead22e8ec
commit 50f578216b
1 changed files with 19 additions and 18 deletions

15
package
View File

@ -21,7 +21,7 @@ def create_args_parser():
parser.add_argument("--rebuild", help="Ignore cache and rebuild container's image", action="store_true", default=False)
parser.add_argument("--debug", help="Will add extra output and start the container in interactive mode", action="store_true", default=False)
parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
parser.add_argument("-d", "--docker-arg", help="Additional argument to pass to the Docker execution", default=[], action='append')
parser.add_argument("-f", "--override-run-flags", help="Override 'docker run' flags", default=[], action='append')
return parser
@ -83,6 +83,13 @@ if __name__ == "__main__":
image_tag = build_image(build_workspace, base_image, args.profile, profile, debug=args.debug, rebuild=args.rebuild)
kwargs = dict()
kwargs['debug'] = args.debug
# Append custom arguments
if len(args.override_run_flags) > 0:
docker_args += args.override_run_flags
else:
# rkt run arguments
docker_args = [
"run",
@ -99,12 +106,6 @@ if __name__ == "__main__":
if proxy_var in os.environ:
docker_args += ["-e", "{:s}={:s}".format(proxy_var, os.environ[proxy_var])]
kwargs = dict()
kwargs['debug'] = args.debug
# Append custom arguments
docker_args += args.docker_arg
if args.debug:
kwargs['pty'] = True
docker_args += ["-it", image_tag, "/bin/sh"]