Update Docker image link
This commit is contained in:
@@ -27,7 +27,7 @@ MAX_RETRY_TIMES = 10
|
|||||||
RETRY_INTERVAL = 5
|
RETRY_INTERVAL = 5
|
||||||
|
|
||||||
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
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"
|
VMS_DIR = "./docker_vm_data"
|
||||||
|
|
||||||
# Determine the platform and CPU architecture to decide the correct VM image to download
|
# 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.")
|
logger.info("Download succeeds.")
|
||||||
break # Download completed successfully
|
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):
|
class DockerVMManager(VMManager):
|
||||||
def __init__(self, registry_path=""):
|
def __init__(self, registry_path=""):
|
||||||
pass
|
pass
|
||||||
@@ -124,6 +130,8 @@ class DockerVMManager(VMManager):
|
|||||||
elif os_type == "Windows":
|
elif os_type == "Windows":
|
||||||
URL = WINDOWS_X86_URL
|
URL = WINDOWS_X86_URL
|
||||||
DOWNLOADED_FILE_NAME = URL.split('/')[-1]
|
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)):
|
if not os.path.exists(os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)):
|
||||||
_download_vm(VMS_DIR)
|
_download_vm(VMS_DIR)
|
||||||
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)
|
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)
|
||||||
@@ -18,10 +18,9 @@ RETRY_INTERVAL = 1
|
|||||||
class DockerProvider(Provider):
|
class DockerProvider(Provider):
|
||||||
def __init__(self, region: str):
|
def __init__(self, region: str):
|
||||||
self.client = docker.from_env()
|
self.client = docker.from_env()
|
||||||
self.vnc_port = self._get_available_port(8006)
|
self.server_port = None
|
||||||
self.server_port = self._get_available_port(5000)
|
self.vnc_port = None
|
||||||
# self.remote_debugging_port = self._get_available_port(1337)
|
self.chromium_port = None
|
||||||
self.chromium_port = self._get_available_port(9222)
|
|
||||||
self.environment = {"DISK_SIZE": "32G", "RAM_SIZE": "4G", "CPU_CORES": "4"} # Modify if needed
|
self.environment = {"DISK_SIZE": "32G", "RAM_SIZE": "4G", "CPU_CORES": "4"} # Modify if needed
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -32,6 +31,10 @@ class DockerProvider(Provider):
|
|||||||
port += 1
|
port += 1
|
||||||
|
|
||||||
def start_emulator(self, path_to_vm: str, headless: bool, os_type: str):
|
def start_emulator(self, path_to_vm: str, headless: bool, os_type: str):
|
||||||
|
self.vnc_port = self._get_available_port(8006)
|
||||||
|
self.server_port = self._get_available_port(5000)
|
||||||
|
# self.remote_debugging_port = self._get_available_port(1337)
|
||||||
|
self.chromium_port = self._get_available_port(9222)
|
||||||
logger.info(f"Occupying ports: {self.vnc_port}, {self.server_port}, {self.chromium_port}")
|
logger.info(f"Occupying ports: {self.vnc_port}, {self.server_port}, {self.chromium_port}")
|
||||||
self.container = self.client.containers.run("happysixd/osworld-docker", environment=self.environment, cap_add=["NET_ADMIN"], devices=["/dev/kvm"], volumes={os.path.abspath(path_to_vm): {"bind": "/System.qcow2", "mode": "ro"}}, ports={8006: self.vnc_port, 5000: self.server_port, 9222: self.chromium_port}, detach=True)
|
self.container = self.client.containers.run("happysixd/osworld-docker", environment=self.environment, cap_add=["NET_ADMIN"], devices=["/dev/kvm"], volumes={os.path.abspath(path_to_vm): {"bind": "/System.qcow2", "mode": "ro"}}, ports={8006: self.vnc_port, 5000: self.server_port, 9222: self.chromium_port}, detach=True)
|
||||||
def download_screenshot(ip, port):
|
def download_screenshot(ip, port):
|
||||||
|
|||||||
Reference in New Issue
Block a user