diff --git a/bentoctl/deployment_config.py b/bentoctl/deployment_config.py index 6e2b2a4..fc0c97d 100644 --- a/bentoctl/deployment_config.py +++ b/bentoctl/deployment_config.py @@ -1,6 +1,7 @@ import copy import logging import os +import shutil import typing as t from contextlib import contextmanager from pathlib import Path @@ -254,7 +255,9 @@ def _prepare_bento_dir(self) -> t.Generator[str, None, None]: model = get_model(model_info.tag) model_fs = models_fs.makedirs(model_info.tag.path()) fs.mirror.mirror(model.path, model_fs) - yield temp_fs.getsyspath("/") + new_temp_dir = temp_fs.getsyspath("/")[:-1] + "-copy" + shutil.copytree(temp_fs.getsyspath("/"), new_temp_dir) + yield new_temp_dir def create_deployable(self, destination_dir=os.curdir) -> str: """ diff --git a/bentoctl/docker_utils.py b/bentoctl/docker_utils.py index d78ecc0..1406e40 100644 --- a/bentoctl/docker_utils.py +++ b/bentoctl/docker_utils.py @@ -1,5 +1,6 @@ from __future__ import annotations +import shutil import typing as t from collections import OrderedDict @@ -118,6 +119,7 @@ def generate_deployable_container( container.health("buildx") backend = container.get_backend("buildx") backend.build(**buildx_args) + shutil.rmtree(buildx_args["context_path"]) def tag_docker_image(image_name, image_tag):