Skip to content

Commit

Permalink
add dev option to build images cli
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicvaz committed Feb 12, 2024
1 parent 71fe3b6 commit 25b28c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
10 changes: 8 additions & 2 deletions src/domino/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 5 additions & 4 deletions src/domino/cli/utils/pieces_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/domino/custom_operators/docker_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
########################################################
Expand Down

0 comments on commit 25b28c1

Please sign in to comment.