Add network option for image building

This commit adds configuration to the Maven and Gradle plugins to
allow specifying the network mode to be provided to the image
building goal and task.

See gh-27486
This commit is contained in:
Jeroen Meijer
2021-07-24 15:47:01 +02:00
committed by Scott Frederick
parent e737388f5c
commit 8e6d03b221
17 changed files with 195 additions and 15 deletions

View File

@@ -42,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Andy Wilkinson
* @author Scott Frederick
* @author Andrey Shlykov
* @author Jeroen Meijer
*/
class BootBuildImageTests {
@@ -278,4 +279,10 @@ class BootBuildImageTests {
.containsExactly(Binding.of("host-src:container-dest:ro"), Binding.of("volume-name:container-dest:rw"));
}
@Test
void whenNetworkIsConfiguredThenRequestHasNetwork() {
this.buildImage.setNetwork("test");
assertThat(this.buildImage.createRequest().getNetwork()).isEqualTo("test");
}
}