33import docker
44from time import sleep
55
6- LOCALSTACK_COMMUNITY_IMAGE_NAME = "localstack/localstack"
7- LOCALSTACK_PRO_IMAGE_NAME = "localstack/localstack-pro"
6+ LOCALSTACK_IMAGE_NAME = "localstack/localstack-pro"
87LATEST_TAG = "latest"
98
109MAX_PORT_CONNECTION_ATTEMPTS = 10
2423class Container :
2524 @staticmethod
2625 def create_localstack_container (
27- pull_new_image : bool ,
28- image_name : str = None ,
26+ * args ,
27+ pull_new_image : bool = False ,
28+ image_name : str = LOCALSTACK_IMAGE_NAME ,
2929 image_tag : str = LATEST_TAG ,
3030 gateway_listen : str = "0.0.0.0:4566" ,
31- environment_variables : dict = None ,
32- bind_ports : dict = None ,
33- pro : bool = False ,
31+ environment_variables : dict | None = None ,
32+ bind_ports : dict | None = None ,
33+ ** kwargs ,
3434 ):
3535 environment_variables = environment_variables or {}
3636 environment_variables ["GATEWAY_LISTEN" ] = gateway_listen
3737
38- image_name_or_default = image_name or (
39- LOCALSTACK_PRO_IMAGE_NAME if pro else LOCALSTACK_COMMUNITY_IMAGE_NAME
40- )
4138 image_exists = (
42- True
43- if len (DOCKER_CLIENT .images .list (name = image_name_or_default ))
44- else False
39+ True if len (DOCKER_CLIENT .images .list (name = image_name )) else False
4540 )
4641
4742 bind_ports = bind_ports or {}
@@ -50,10 +45,10 @@ def create_localstack_container(
5045
5146 if pull_new_image or not image_exists :
5247 logging .info ("Pulling latest image" )
53- DOCKER_CLIENT .images .pull (image_name_or_default , image_tag )
48+ DOCKER_CLIENT .images .pull (image_name , image_tag )
5449
5550 return DOCKER_CLIENT .containers .run (
56- image_name_or_default ,
51+ image_name ,
5752 ports = bind_ports ,
5853 environment = environment_variables ,
5954 detach = True ,
0 commit comments