|
70 | 70 | public class NativeAdvancedImageFromDockerfile |
71 | 71 | extends AbstractImageFromDockerfile<NativeAdvancedImageFromDockerfile> |
72 | 72 | { |
73 | | - protected List<String> baseCommand = List.of("docker", "build"); |
| 73 | + protected List<String> baseCommand = List.of("docker", "buildx", "build"); |
74 | 74 | protected List<String> additionalArgs = new ArrayList<>(); |
75 | 75 | protected Optional<String> optCacheFrom = Optional.empty(); |
76 | 76 | protected Optional<String> optCacheTo = Optional.empty(); |
| 77 | + protected boolean load = true; |
77 | 78 |
|
78 | 79 | protected Duration timeout = Duration.ofMinutes(5); |
79 | 80 |
|
@@ -108,12 +109,18 @@ protected List<String> buildCommand(final Optional<String> optDockerFilePath) |
108 | 109 | .filter(Optional::isPresent) |
109 | 110 | .mapToInt(o -> 2) |
110 | 111 | .sum() |
| 112 | + + (this.load ? 1 : 0) |
111 | 113 | ); |
112 | 114 |
|
113 | 115 | commandArgs.addAll(this.baseCommand); |
114 | 116 |
|
115 | 117 | this.addCommandArg(optDockerFilePath, "-f", commandArgs); |
116 | 118 |
|
| 119 | + if(this.load) |
| 120 | + { |
| 121 | + commandArgs.add("--load"); |
| 122 | + } |
| 123 | + |
117 | 124 | this.addCommandArg(this.optTarget, "--target", commandArgs); |
118 | 125 | this.addCommandArg(this.optCacheFrom, "--cache-from", commandArgs); |
119 | 126 | this.addCommandArg(this.optCacheTo, "--cache-to", commandArgs); |
@@ -310,5 +317,11 @@ public NativeAdvancedImageFromDockerfile withCacheTo(final String cacheTo) |
310 | 317 | return this; |
311 | 318 | } |
312 | 319 |
|
| 320 | + public NativeAdvancedImageFromDockerfile withLoad(final boolean load) |
| 321 | + { |
| 322 | + this.load = load; |
| 323 | + return this; |
| 324 | + } |
| 325 | + |
313 | 326 | // endregion |
314 | 327 | } |
0 commit comments