Commit b859bc01 authored by Olav Morken's avatar Olav Morken

Add --file option, which will be passed to `docker build`.

This option allows us to specify a custom Dockerfile when building the image.
parent 41b07e4b
......@@ -30,6 +30,9 @@ class _DockerRunner(object):
# Timeout in seconds.
timeout = None
# Pass-trough for Docker build --file flag
file = None
# Pass-through for Docker --env flag
env = None
......@@ -58,6 +61,7 @@ class _DockerRunner(object):
self.name = args.name
self.hostname = args.hostname
self.timeout = args.timeout
self.file = args.file
self.env = args.env
self.device = args.device
self.cap_add = args.cap_add
......@@ -148,6 +152,7 @@ class _DockerRunner(object):
cmd = [
'docker', 'build',
'--no-cache',
'--file=' + self.file,
'-t', self._docker_image_name,
'.'
]
......@@ -282,6 +287,7 @@ parser = argparse.ArgumentParser()
parser.add_argument('--name', required=True, help="Name of task to run. Mainly used to identify the docker image.")
parser.add_argument('--hostname', help="Hostname of the tasks container when it runs.")
parser.add_argument('--timeout', type=float, default=60.0, help="Timeout for the task in seconds. Default is 60 seconds.")
parser.add_argument('--file', action='store', default='Dockerfile', help="Pass-through for Docker build --file option.")
parser.add_argument('--env', action='append', default=[], help="Pass-through for Docker --env option.")
parser.add_argument('--device', action='append', default=[], help="Pass-through for Docker --device option.")
parser.add_argument('--cap-add', action='append', default=[], help="Pass-through for Docker --cap-add option.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment