4
4
import java .util .ArrayList ;
5
5
import java .util .Collections ;
6
6
import java .util .List ;
7
+ import java .util .concurrent .atomic .AtomicBoolean ;
7
8
import java .util .function .Function ;
8
9
import java .util .stream .Stream ;
9
10
@@ -22,6 +23,7 @@ public abstract class NativeImageBuildContainerRunner extends NativeImageBuildRu
22
23
protected final ContainerRuntimeUtil .ContainerRuntime containerRuntime ;
23
24
String [] baseContainerRuntimeArgs ;
24
25
private final String containerName ;
26
+ private final AtomicBoolean setupInvoked = new AtomicBoolean ();
25
27
26
28
protected NativeImageBuildContainerRunner (NativeConfig nativeConfig ) {
27
29
this .nativeConfig = nativeConfig ;
@@ -39,7 +41,10 @@ public boolean isContainer() {
39
41
40
42
@ Override
41
43
public void setup (boolean processInheritIODisabled ) {
42
- if (containerRuntime != ContainerRuntimeUtil .ContainerRuntime .UNAVAILABLE ) {
44
+ if (containerRuntime == ContainerRuntimeUtil .ContainerRuntime .UNAVAILABLE ) {
45
+ return ;
46
+ }
47
+ if (setupInvoked .compareAndSet (false , true )) {
43
48
log .infof ("Using %s to run the native image builder" , containerRuntime .getExecutableName ());
44
49
// we pull the docker image in order to give users an indication of which step the process is at
45
50
// it's not strictly necessary we do this, however if we don't the subsequent version command
@@ -91,6 +96,7 @@ public void setup(boolean processInheritIODisabled) {
91
96
pull (effectiveBuilderImage , processInheritIODisabled );
92
97
}
93
98
}
99
+
94
100
}
95
101
96
102
private void pull (String effectiveBuilderImage , boolean processInheritIODisabled ) {
0 commit comments