Skip to content

Commit a0f982f

Browse files
Brandon Duane Walkermr-c
authored andcommitted
patch dockerFile build
1 parent 81b5f84 commit a0f982f

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

cwltool/docker.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,27 @@ def get_image(
127127
except (OSError, subprocess.CalledProcessError, UnicodeError):
128128
pass
129129

130+
cmd: List[str] = []
131+
if "dockerFile" in docker_requirement:
132+
dockerfile_dir = create_tmp_dir(tmp_outdir_prefix)
133+
with open(os.path.join(dockerfile_dir, "Dockerfile"), "w") as dfile:
134+
dfile.write(docker_requirement["dockerFile"])
135+
cmd = [
136+
self.docker_exec,
137+
"build",
138+
"--tag=%s" % str(docker_requirement["dockerImageId"]),
139+
dockerfile_dir,
140+
]
141+
_logger.info(str(cmd))
142+
subprocess.check_call(cmd, stdout=sys.stderr) # nosec
143+
found = True
144+
130145
if (force_pull or not found) and pull_image:
131-
cmd: List[str] = []
132146
if "dockerPull" in docker_requirement:
133147
cmd = [self.docker_exec, "pull", str(docker_requirement["dockerPull"])]
134148
_logger.info(str(cmd))
135149
subprocess.check_call(cmd, stdout=sys.stderr) # nosec
136150
found = True
137-
elif "dockerFile" in docker_requirement:
138-
dockerfile_dir = create_tmp_dir(tmp_outdir_prefix)
139-
with open(os.path.join(dockerfile_dir, "Dockerfile"), "w") as dfile:
140-
dfile.write(docker_requirement["dockerFile"])
141-
cmd = [
142-
self.docker_exec,
143-
"build",
144-
"--tag=%s" % str(docker_requirement["dockerImageId"]),
145-
dockerfile_dir,
146-
]
147-
_logger.info(str(cmd))
148-
subprocess.check_call(cmd, stdout=sys.stderr) # nosec
149-
found = True
150151
elif "dockerLoad" in docker_requirement:
151152
cmd = [self.docker_exec, "load"]
152153
_logger.info(str(cmd))

0 commit comments

Comments
 (0)