Skip to content

Commit 57dd8a9

Browse files
authored
added container network feature to build (#142)
1 parent 8fe607e commit 57dd8a9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

imagetool/src/main/java/com/oracle/weblogic/imagetool/cli/menu/CommonOptions.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ DockerBuildCommand getInitialBuildCmd(String contextFolder) {
114114

115115
cmdBuilder.setTag(imageTag);
116116

117+
if (!Utils.isEmptyString(buildNetwork)) {
118+
cmdBuilder.addNetworkArg(buildNetwork);
119+
}
120+
117121
if (!Utils.isEmptyString(httpProxyUrl)) {
118122
cmdBuilder.addBuildArg("http_proxy", httpProxyUrl);
119123
}
@@ -388,13 +392,19 @@ String getPassword() {
388392
)
389393
List<String> patches = new ArrayList<>();
390394

391-
392395
@Option(
393396
names = {"--opatchBugNumber"},
394397
description = "the patch number for OPatch (patching OPatch)"
395398
)
396399
String opatchBugNumber = "28186730_13.9.4.2.2";
397400

401+
@Option(
402+
names = {"--buildNetwork"},
403+
description = "Set the networking mode for the RUN instructions during build"
404+
)
405+
String buildNetwork;
406+
407+
@SuppressWarnings("unused")
398408
@Unmatched
399409
List<String> unmatchedOptions;
400410
}

imagetool/src/main/java/com/oracle/weblogic/imagetool/util/DockerBuildCommand.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ public void addBuildArg(String key, String value, boolean conceal) {
7474
buildArgs.add(arg);
7575
}
7676

77+
/**
78+
* Add a --network to the Docker build command.
79+
* @param value the Docker network to use
80+
*/
81+
public void addNetworkArg(String value) {
82+
command.add("--network");
83+
command.add(value);
84+
}
85+
7786
/**
7887
* Executes the given docker command and writes the process stdout to log.
7988
*

0 commit comments

Comments
 (0)