From 5a9852896d98b5efe8ccd4a93059ddef71a1c787 Mon Sep 17 00:00:00 2001 From: Michael Nedokushev Date: Wed, 12 Apr 2023 09:16:39 +0100 Subject: [PATCH] Align localstack v1 with other containers allowing to override docker image entirely --- .../dimafeng/testcontainers/LocalStackContainer.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/localstack/src/main/scala/com/dimafeng/testcontainers/LocalStackContainer.scala b/modules/localstack/src/main/scala/com/dimafeng/testcontainers/LocalStackContainer.scala index 1ef19138..28247b14 100644 --- a/modules/localstack/src/main/scala/com/dimafeng/testcontainers/LocalStackContainer.scala +++ b/modules/localstack/src/main/scala/com/dimafeng/testcontainers/LocalStackContainer.scala @@ -3,14 +3,15 @@ package com.dimafeng.testcontainers import com.amazonaws.auth.AWSCredentialsProvider import com.amazonaws.client.builder.AwsClientBuilder import org.testcontainers.containers.localstack.{LocalStackContainer => JavaLocalStackContainer} +import org.testcontainers.utility.DockerImageName case class LocalStackContainer( - tag: String = LocalStackContainer.defaultTag, + dockerImageName: DockerImageName = DockerImageName.parse(LocalStackContainer.defaultDockerImageName), services: Seq[LocalStackContainer.Service] = Seq.empty ) extends SingleContainer[JavaLocalStackContainer] { override val container: JavaLocalStackContainer = { - val c = new JavaLocalStackContainer(tag) + val c = new JavaLocalStackContainer(dockerImageName) c.withServices(services: _*) c } @@ -23,12 +24,14 @@ case class LocalStackContainer( object LocalStackContainer { + val defaultImage = "localstack/localstack" val defaultTag = "0.12.12" + val defaultDockerImageName = s"$defaultImage:$defaultTag" type Service = JavaLocalStackContainer.Service case class Def( - tag: String = LocalStackContainer.defaultTag, + dockerImageName: DockerImageName = DockerImageName.parse(LocalStackContainer.defaultDockerImageName), services: Seq[LocalStackContainer.Service] = Seq.empty ) extends ContainerDef { @@ -36,7 +39,7 @@ object LocalStackContainer { override def createContainer(): LocalStackContainer = { new LocalStackContainer( - tag, + dockerImageName, services ) }