Update Docker image link

This commit is contained in:
FredWuCZ
2024-10-17 14:55:20 +08:00
parent 6e75e37eb0
commit ec3671ae01
2 changed files with 16 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ MAX_RETRY_TIMES = 10
RETRY_INTERVAL = 5
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
WINDOWS_X86_URL = r"https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows-10-x64.qcow2"
WINDOWS_X86_URL = "https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows-10-x64.qcow2.zip"
VMS_DIR = "./docker_vm_data"
# Determine the platform and CPU architecture to decide the correct VM image to download
@@ -95,6 +95,12 @@ def _download_vm(vms_dir: str):
logger.info("Download succeeds.")
break # Download completed successfully
# Unzip the downloaded file
logger.info("Unzipping the downloaded file...☕️")
with zipfile.ZipFile(downloaded_file_path, 'r') as zip_ref:
zip_ref.extractall(vms_dir)
logger.info("Files have been successfully extracted to the directory: " + str(vms_dir))
class DockerVMManager(VMManager):
def __init__(self, registry_path=""):
pass
@@ -124,6 +130,8 @@ class DockerVMManager(VMManager):
elif os_type == "Windows":
URL = WINDOWS_X86_URL
DOWNLOADED_FILE_NAME = URL.split('/')[-1]
if DOWNLOADED_FILE_NAME.endswith(".zip"):
DOWNLOADED_FILE_NAME = DOWNLOADED_FILE_NAME[:-4]
if not os.path.exists(os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)):
_download_vm(VMS_DIR)
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)