Skip to content
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
14 changes: 9 additions & 5 deletions localstack_utils/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from time import sleep

LOCALSTACK_IMAGE_NAME = "localstack/localstack-pro"
LATEST_TAG = "latest"
DEV_TAG = "dev"

MAX_PORT_CONNECTION_ATTEMPTS = 10
MAX_LOG_COLLECTION_ATTEMPTS = 120
Expand All @@ -29,7 +29,7 @@ def create_localstack_container(
*args,
pull_new_image: bool = False,
image_name: str = LOCALSTACK_IMAGE_NAME,
image_tag: str = LATEST_TAG,
image_tag: str = DEV_TAG,
container_name: str = DEFAULT_CONTAINER_ID,
gateway_listen: str = "0.0.0.0:4566",
auto_remove: bool = False,
Expand All @@ -39,8 +39,12 @@ def create_localstack_container(
):
environment_variables = environment_variables or {}
environment_variables["GATEWAY_LISTEN"] = gateway_listen
if "LOCALSTACK_AUTH_TOKEN" not in environment_variables and os.environ.get("LOCALSTACK_AUTH_TOKEN"):
environment_variables["LOCALSTACK_AUTH_TOKEN"] = os.environ["LOCALSTACK_AUTH_TOKEN"]
if "LOCALSTACK_AUTH_TOKEN" not in environment_variables and os.environ.get(
"LOCALSTACK_AUTH_TOKEN"
):
environment_variables["LOCALSTACK_AUTH_TOKEN"] = os.environ[
"LOCALSTACK_AUTH_TOKEN"
]

image_exists = (
True if len(DOCKER_CLIENT.images.list(name=image_name)) else False
Expand All @@ -51,7 +55,7 @@ def create_localstack_container(
bind_ports.update({gateway_port: gateway_port})

if pull_new_image or not image_exists:
logging.info("Pulling latest image")
logging.info("Pulling latest development image")
DOCKER_CLIENT.images.pull(image_name, image_tag)

return DOCKER_CLIENT.containers.run(
Expand Down
4 changes: 2 additions & 2 deletions localstack_utils/localstack.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import docker
import logging
from localstack_utils.container import Container
from localstack_utils.container import DEV_TAG, Container
from localstack_utils.localstack_docker_configuration import (
LocalstackDockerConfiguration,
)
Expand Down Expand Up @@ -71,7 +71,7 @@ def setup_logger(self):

def startup_localstack(
image_name="",
tag="",
tag=DEV_TAG,
container_name="",
pro=False,
ports=None,
Expand Down
Loading