Support uploaded config, add 'publish-webapp-deployer' and 'request-webapp-deployment' commands #938
@ -36,7 +36,7 @@ WEBAPP_PORT = 80
|
||||
@click.option("--port", help="port to use (default random)")
|
||||
@click.pass_context
|
||||
def command(ctx, image, env_file, port):
|
||||
"""run the specified webapp container"""
|
||||
'''run the specified webapp container'''
|
||||
|
||||
env = {}
|
||||
if env_file:
|
||||
@ -46,33 +46,20 @@ def command(ctx, image, env_file, port):
|
||||
hash = hashlib.md5(unique_cluster_descriptor.encode()).hexdigest()
|
||||
cluster = f"laconic-webapp-{hash}"
|
||||
|
||||
deployer = getDeployer(
|
||||
type=constants.compose_deploy_type,
|
||||
deployment_context=None,
|
||||
compose_files=None,
|
||||
compose_project_name=cluster,
|
||||
compose_env_file=None,
|
||||
)
|
||||
deployer = getDeployer(type=constants.compose_deploy_type,
|
||||
deployment_context=None,
|
||||
compose_files=None,
|
||||
compose_project_name=cluster,
|
||||
compose_env_file=None)
|
||||
|
||||
ports = []
|
||||
if port:
|
||||
ports = [(port, WEBAPP_PORT)]
|
||||
container = deployer.run(
|
||||
image,
|
||||
command=[],
|
||||
user=None,
|
||||
volumes=[],
|
||||
entrypoint=None,
|
||||
env=env,
|
||||
ports=ports,
|
||||
detach=True,
|
||||
)
|
||||
container = deployer.run(image, command=[], user=None, volumes=[], entrypoint=None, env=env, ports=ports, detach=True)
|
||||
|
||||
# Make configurable?
|
||||
webappPort = f"{WEBAPP_PORT}/tcp"
|
||||
# TODO: This assumes a Docker container object...
|
||||
if webappPort in container.network_settings.ports:
|
||||
mapping = container.network_settings.ports[webappPort][0]
|
||||
print(
|
||||
f"""Image: {image}\nID: {container.id}\nURL: http://localhost:{mapping['HostPort']}"""
|
||||
)
|
||||
print(f"""Image: {image}\nID: {container.id}\nURL: http://localhost:{mapping['HostPort']}""")
|
||||
|
Loading…
Reference in New Issue
Block a user