diff --git a/src/domino/cli/cli.py b/src/domino/cli/cli.py index 270b6807..55759825 100644 --- a/src/domino/cli/cli.py +++ b/src/domino/cli/cli.py @@ -302,9 +302,15 @@ def cli_create_piece_repository(name, container_registry): default="", help='Overwrite tag for release.' ) -def cli_organize_pieces_repository(build_images: bool, source_url: str, tag_overwrite: str): +@click.option( + '--dev', + is_flag=True, + prompt='Build from dev base images?', + default=False +) +def cli_organize_pieces_repository(build_images: bool, source_url: str, tag_overwrite: str, dev: bool): """Organize Pieces repository.""" - pieces_repository.organize_pieces_repository(build_images, source_url, tag_overwrite) + pieces_repository.organize_pieces_repository(build_images, source_url, tag_overwrite, dev) @click.command() diff --git a/src/domino/cli/utils/pieces_repository.py b/src/domino/cli/utils/pieces_repository.py index 0b645713..73663c02 100644 --- a/src/domino/cli/utils/pieces_repository.py +++ b/src/domino/cli/utils/pieces_repository.py @@ -346,14 +346,14 @@ def create_dependencies_map(save_map_as_file: bool = True) -> None: json.dump(pieces_images_map, outfile, indent=4, cls=SetEncoder) -def build_docker_images(tag_overwrite: str | None = None) -> None: +def build_docker_images(tag_overwrite: str | None = None, dev: bool = False) -> None: """ Convenience function to build Docker images from the repository dependencies and publish them to Docker Hub """ from domino.scripts.build_docker_images_pieces import build_images_from_pieces_repository console.print("Building Docker images and generating map file...") - updated_dependencies_map = build_images_from_pieces_repository(tag_overwrite=tag_overwrite) + updated_dependencies_map = build_images_from_pieces_repository(tag_overwrite=tag_overwrite, dev=dev) return updated_dependencies_map @@ -388,7 +388,8 @@ def validate_repo_name(repo_name: str) -> None: def organize_pieces_repository( build_images: bool, source_url: str, - tag_overwrite: str | None = None + tag_overwrite: str | None = None, + dev: bool = False ) -> None: """ Organize Piece's repository for Domino. This will: @@ -423,7 +424,7 @@ def organize_pieces_repository( # Build and publish the images if build_images: - updated_dependencies_map = build_docker_images(tag_overwrite=tag_overwrite) + updated_dependencies_map = build_docker_images(tag_overwrite=tag_overwrite, dev=dev) map_file_path = Path(".") / ".domino/dependencies_map.json" with open(map_file_path, "w") as outfile: json.dump(updated_dependencies_map, outfile, indent=4) diff --git a/src/domino/custom_operators/docker_operator.py b/src/domino/custom_operators/docker_operator.py index b037f2d7..4b538547 100644 --- a/src/domino/custom_operators/docker_operator.py +++ b/src/domino/custom_operators/docker_operator.py @@ -58,12 +58,12 @@ def __init__( dev_pieces = False if dev_pieces: piece_repo_name = repository_url.split("/")[-1] - local_repos_path = f"/mnt/shared_storage/Github/{piece_repo_name}" - # local_repos_path = f"/home/vinicius/Documents/work/tauffer/{piece_repo_name}" + #local_repos_path = f"/mnt/shared_storage/Github/{piece_repo_name}" + local_repos_path = f"/home/vinicius/Documents/work/tauffer/{piece_repo_name}" mounts = [ # TODO remove - # Mount(source='/home/vinicius/Documents/work/tauffer/domino/src/domino', target='/usr/local/lib/python3.10/site-packages/domino/', type='bind', read_only=True), - Mount(source='/mnt/shared_storage/Github/domino/src/domino', target='/usr/local/lib/python3.10/site-packages/domino/', type='bind', read_only=True), + Mount(source='/home/vinicius/Documents/work/tauffer/domino/src/domino', target='/usr/local/lib/python3.10/site-packages/domino/', type='bind', read_only=True), + #Mount(source='/mnt/shared_storage/Github/domino/src/domino', target='/usr/local/lib/python3.10/site-packages/domino/', type='bind', read_only=True), Mount(source=local_repos_path, target='/home/domino/pieces_repository/', type='bind', read_only=True), ] ########################################################