Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

fix: prevent deleting temp directory before docker build process #217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bentoctl/deployment_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import logging
import os
import shutil
import typing as t
from contextlib import contextmanager
from pathlib import Path
Expand Down Expand Up @@ -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:
"""
Expand Down
2 changes: 2 additions & 0 deletions bentoctl/docker_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import shutil
import typing as t
from collections import OrderedDict

Expand Down Expand Up @@ -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):
Expand Down