Skip to content
Permalink
d9f840130b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
56 lines (49 sloc) 1.08 KB
import subprocess
import shlex
def run(
env,
build=False,
cmd=[]
):
if len(cmd) > 0:
# run application
subprocess.call(
shlex.split("docker-compose run webserver") + cmd,
env=env
)
else:
# run application
subprocess.call(
shlex.split("docker-compose up -d") + (["--build"] if build else []),
env=env
)
def exec_in_xmldb(
*args,
env=None
):
cmd = \
shlex.split("docker-compose exec xmldb java -jar start.jar client --no-gui")
if args is not None:
cmd.extend( args )
print( "cmd: " + str(cmd) )
subprocess.check_call(
cmd,
env=env
)
def exec_in_container(
*args,
env=None
):
from functools import reduce
cmd = \
[ "docker-compose", "exec", "webserver", "bash" ]
if len(args) != 0:
cmd.append( "-c" )
cmd.append(
reduce(lambda x,y: x + " " + y, args )
)
print( "cmd: " + str(cmd) )
subprocess.check_call(
cmd,
env=env
)