Skip to content

Commit

Permalink
Merge pull request #333 from kellrott/build-pull
Browse files Browse the repository at this point in the history
Add docker pull attempt when missing Dockerfile
  • Loading branch information
jmchilton committed Oct 19, 2015
2 parents 4d6f7d9 + 60e100c commit e879360
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 7 additions & 0 deletions planemo_ext/galaxy/tools/deps/docker_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def build_save_image_command(
build_command_parts.extend(["save", "-o", destination, image])
return build_command_parts

def build_pull_command(
tag,
**kwds
):
build_command_parts = __docker_prefix(**kwds)
build_command_parts.extend(["pull", tag])
return build_command_parts

def build_docker_cache_command(
image,
Expand Down
17 changes: 11 additions & 6 deletions planemo_ext/galaxy/tools/deps/dockerfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ def dockerfile_build(path, dockerfile=None, error=log.error, **kwds):
image_identifier = expected_container_names.pop()

dockerfile = __find_dockerfile(dockerfile, tool_directories)
docker_command_parts = docker_util.build_command(
image_identifier,
dockerfile,
**docker_host_args(**kwds)
)
if dockerfile is not None:
docker_command_parts = docker_util.build_command(
image_identifier,
dockerfile,
**docker_host_args(**kwds)
)
else:
docker_command_parts = docker_util.build_pull_command(image_identifier, **docker_host_args(**kwds))
commands.execute(docker_command_parts)

commands.execute(docker_command_parts)
docker_image_cache = kwds['docker_image_cache']
if docker_image_cache:
Expand All @@ -67,4 +72,4 @@ def __find_dockerfile(dockerfile, tool_directories):
potential_dockerfile = os.path.join(directory, "Dockerfile")
if os.path.exists(potential_dockerfile):
return potential_dockerfile
raise Exception("Could not find dockerfile to build.")
return None

0 comments on commit e879360

Please sign in to comment.