Skip to content

Commit

Permalink
Fix: add --no-container option.
Browse files Browse the repository at this point in the history
It should have been included in the previous release.
  • Loading branch information
wilderlopes committed Mar 8, 2024
1 parent bb4c7a0 commit e75fda7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions miniogre/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def spin_up_container(image_name, project_path, port):

return 0

def create_sbom(image_name, project_path, format):
def create_sbom(image_name, project_path, format, verbose = False):
# Create SBOM from inside the container
print(emoji.emojize(':desktop_computer: Generating SBOM...'))

Expand All @@ -461,9 +461,12 @@ def create_sbom(image_name, project_path, format):
sbom_cmd = (
" docker run -d --rm -v {}:/opt/{} --name {}_sbom {} bash -c '{}; wait'".format(project_path, project_name, container_name, image_name, sbom_format_cmd)
)

print(sbom_cmd)
p = subprocess.Popen(sbom_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
if verbose:
stderr = None
print(sbom_cmd)
else:
stderr = subprocess.PIPE
p = subprocess.Popen(sbom_cmd, stdout=subprocess.PIPE, stderr=stderr, shell=True)
p.communicate()
p.wait()

Expand Down
6 changes: 4 additions & 2 deletions miniogre/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def run(provider: str = 'openai',
dry: bool = False,
force_requirements_generation: bool = True,
sbom_format: str = 'pip-licenses',
no_container: bool = False,
verbose: bool = False):
"""
Run miniogre
Expand Down Expand Up @@ -74,9 +75,10 @@ def run(provider: str = 'openai',
config_bashrc(project_path, ogre_dir_path, None, None, None)
config_dockerfile(project_path, project_name, ogre_dir_path, baseimage, dry)
build_docker_image(os.path.join(ogre_dir_path, "Dockerfile"), project_name, verbose)
create_sbom(project_name, project_path, sbom_format)
create_sbom(project_name, project_path, sbom_format, verbose)
end_emoji()
spin_up_container(project_name, project_path, port)
if no_container == False:
spin_up_container(project_name, project_path, port)

if __name__ == '__main__':
app()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "miniogre"
version = "0.4.0"
version = "0.4.1"
description = "miniogre: automate the installation of Python dependencies with AI, to ensure your code runs on any computer"
readme = "README.md"
authors = ["Wilder Lopes <[email protected]>"]
Expand Down

0 comments on commit e75fda7

Please sign in to comment.