Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion planemo/commands/cmd_docker_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""
from __future__ import print_function
import click

import os
from planemo.cli import pass_context
from planemo import options

Expand Down Expand Up @@ -59,10 +59,29 @@ def cli(ctx, path, **kwds):
if kwds["from_tag"]:
identifier = "-t %s" % identifier

tool_dir = os.path.dirname(os.path.abspath(path))
working_dir = os.path.abspath(os.getcwd())
if tool_dir.startswith(working_dir):
volumes = [
"%s:%s" % (working_dir, working_dir)
]
elif working_dir.startswith(tool_dir):
volumes = [
"%s:%s" % (tool_dir, tool_dir)
]
else:
volumes = [
"%s:%s" % (working_dir, working_dir),
"%s:%s" % (tool_dir, tool_dir)
]

script = docker_util.build_docker_run_command(
"/bin/bash",
identifier,
interactive=True,
terminal=True,
working_directory=working_dir,
volumes=volumes,
**dockerfiles.docker_host_args(**kwds)
)
print(script)
3 changes: 3 additions & 0 deletions planemo_ext/galaxy/tools/deps/docker_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def build_docker_run_command(
container_command,
image,
interactive=False,
terminal=False,
tag=None,
volumes=[],
volumes_from=DEFAULT_VOLUMES_FROM,
Expand All @@ -134,6 +135,8 @@ def build_docker_run_command(
command_parts.append("run")
if interactive:
command_parts.append("-i")
if terminal:
command_parts.append("-t")
for env_directive in env_directives:
command_parts.extend(["-e", env_directive])
for volume in volumes:
Expand Down