No lint
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 37s
Smoke Test / Run basic test suite (pull_request) Successful in 5m4s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m8s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m53s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 8m27s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 10m28s

This commit is contained in:
Thomas E Lackey 2024-08-26 22:33:00 -05:00
parent 1f5549a8bb
commit f0020f3b18

View File

@ -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']}""")