@@ -2,14 +2,20 @@ package com.malinskiy.marathon.cache.gradle
2
2
3
3
import org.testcontainers.containers.GenericContainer
4
4
import org.testcontainers.containers.wait.strategy.Wait
5
+ import org.testcontainers.utility.MountableFile
5
6
import java.net.URI
6
7
import java.time.Duration
7
8
8
- class GradleCacheContainer (image : String = " $DEFAULT_IMAGE_NAME : $DEFAULT_TAG " ) :
9
+ class GradleCacheContainer (image : String = DEFAULT_IMAGE ) :
9
10
GenericContainer <GradleCacheContainer >(image) {
10
11
11
12
init {
12
13
addExposedPorts(DEFAULT_PORT )
14
+ withCommand(" start" , " --no-warn-anon-cache-write" )
15
+ withCopyFileToContainer(MountableFile .forClasspathResource(" config.yaml" ), " /data/conf/config.yaml" )
16
+ withLogConsumer {
17
+ logger().info(it.utf8String)
18
+ }
13
19
waitStrategy = Wait
14
20
.forLogMessage(" .*Build cache node started(?s).*" , 1 )
15
21
.withStartupTimeout(Duration .ofSeconds(DEFAULT_STARTUP_TIMEOUT_SECONDS ))
@@ -22,8 +28,7 @@ class GradleCacheContainer(image: String = "$DEFAULT_IMAGE_NAME:$DEFAULT_TAG") :
22
28
get() = getMappedPort(DEFAULT_PORT )
23
29
24
30
private companion object {
25
- private const val DEFAULT_IMAGE_NAME = " gradle/build-cache-node"
26
- private const val DEFAULT_TAG = " 9.0"
31
+ private const val DEFAULT_IMAGE = " gradle/build-cache-node:20.1"
27
32
private const val DEFAULT_PORT = 5071
28
33
private const val DEFAULT_STARTUP_TIMEOUT_SECONDS = 60L
29
34
}
0 commit comments