Skip to content

Commit

Permalink
Auto generate run and bash commands for docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmoreton committed Jul 15, 2024
1 parent 52cadae commit a069222
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/check_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,12 @@ def check_remote(repo_url, report):

process = click.confirm("Do you want to continue with the above details?", default=True)

# console.clear()

if not process:
console.print("Exiting ...", style="red1")
exit()

# run the docker image
docker = DockerManager(
docker_image,
poetry_version,
repository_manager.get_repo_dir,
)

docker.generate_run_command()
docker.generate_bash_command()
docker = DockerManager(docker_image, poetry_version, repository_manager.get_repo_dir)

console.print(
f"Build & run a docker container with the following command:\n\n{docker.run_cmd}\n'{docker.bash_cmd}'\n",
Expand Down
4 changes: 4 additions & 0 deletions src/managers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class DockerManager:
run_cmd: str = field(init=False)
bash_cmd: str = field(init=False)

def __post_init__(self):
self.generate_run_command()
self.generate_bash_command()

def generate_run_command(self):
cmd = [
"docker run --name",
Expand Down

0 comments on commit a069222

Please sign in to comment.