@@ -46,16 +46,16 @@ public abstract class ImageOperation implements Callable<CommandResponse> {
4646 protected DockerfileOptions dockerfileOptions ;
4747 protected CacheStore cacheStore = new CacheStoreFactory ().get ();
4848 private String nonProxyHosts = null ;
49- boolean isCLIMode ;
49+ boolean isCliMode ;
5050 String password ;
5151
5252 ImageOperation () {
5353 dockerfileOptions = new DockerfileOptions ();
5454 }
5555
56- ImageOperation (boolean isCLIMode ) {
56+ ImageOperation (boolean isCliMode ) {
5757 this ();
58- this .isCLIMode = isCLIMode ;
58+ this .isCliMode = isCliMode ;
5959 }
6060
6161 @ Override
@@ -136,8 +136,6 @@ List<String> handlePatchFiles(String tmpDir, Path tmpPatchesDir) throws Exceptio
136136 }
137137 }
138138 if (!patchLocations .isEmpty ()) {
139- retVal .add (Constants .BUILD_ARG );
140- retVal .add ("PATCHDIR=" + Paths .get (tmpDir ).relativize (tmpPatchesDir ).toString ());
141139 dockerfileOptions .setPatchingEnabled ();
142140 }
143141 logger .exiting (retVal .size ());
@@ -193,7 +191,7 @@ public Path createPatchesTempDirectory(String tmpDir) throws IOException {
193191 return tmpPatchesDir ;
194192 }
195193
196- void handleProxyUrls () throws IOException {
194+ private void handleProxyUrls () throws IOException {
197195 httpProxyUrl = Utils .findProxyUrl (httpProxyUrl , Constants .HTTP );
198196 httpsProxyUrl = Utils .findProxyUrl (httpsProxyUrl , Constants .HTTPS );
199197 nonProxyHosts = Utils .findProxyUrl (nonProxyHosts , "none" );
@@ -317,9 +315,12 @@ private List<String> getWdtRequiredBuildArgs(Path wdtVariablesPath) throws IOExc
317315 * @throws IOException in case of error
318316 */
319317 protected List <String > handleWdtArgsIfRequired (String tmpDir ) throws IOException {
320- logger .finer ("Entering CreateImage.handleWdtArgsIfRequired: " + tmpDir );
318+ logger .entering (tmpDir );
319+
321320 List <String > retVal = new LinkedList <>();
322321 if (wdtModelPath != null ) {
322+ dockerfileOptions .setWdtEnabled ();
323+ dockerfileOptions .setWdtModelOnly (wdtModelOnly );
323324 String [] modelFiles = wdtModelPath .toString ().split ("," );
324325 List <String > modelList = new ArrayList <>();
325326
@@ -335,34 +336,28 @@ protected List<String> handleWdtArgsIfRequired(String tmpDir) throws IOException
335336 }
336337 dockerfileOptions .setWdtModels (modelList );
337338
339+ dockerfileOptions .setWdtDomainType (wdtDomainType );
338340 if (wdtDomainType != DomainType .WLS ) {
339341 if (installerType != WLSInstallerType .FMW ) {
340342 throw new IOException ("FMW installer is required for JRF domain" );
341343 }
342- retVal .add (Constants .BUILD_ARG );
343- retVal .add ("DOMAIN_TYPE=" + wdtDomainType );
344344 if (runRcu ) {
345345 retVal .add (Constants .BUILD_ARG );
346346 retVal .add ("RCU_RUN_FLAG=" + "-run_rcu" );
347347 }
348348 }
349- dockerfileOptions .setWdtEnabled ();
350349
351350 if (wdtArchivePath != null && Files .isRegularFile (wdtArchivePath )) {
352351 String wdtArchiveFilename = wdtArchivePath .getFileName ().toString ();
353352 Files .copy (wdtArchivePath , Paths .get (tmpDir , wdtArchiveFilename ));
354- retVal .add (Constants .BUILD_ARG );
355- retVal .add ("WDT_ARCHIVE=" + wdtArchiveFilename );
356- }
357- if (wdtDomainHome != null ) {
358- retVal .add (Constants .BUILD_ARG );
359- retVal .add ("DOMAIN_HOME=" + wdtDomainHome );
353+ //Until WDT supports multiple archives, take single file argument from CLI and convert to list
354+ List <String > archives = new ArrayList <>();
355+ archives .add (wdtArchiveFilename );
356+ dockerfileOptions .setWdtArchives (archives );
360357 }
358+ dockerfileOptions .setDomainHome (wdtDomainHome );
361359
362- if (wdtJavaOptions != null ) {
363- retVal .add (Constants .BUILD_ARG );
364- retVal .add ("WLSDEPLOY_PROPERTIES=" + wdtJavaOptions );
365- }
360+ dockerfileOptions .setJavaOptions (wdtJavaOptions );
366361
367362 if (wdtVariablesPath != null && Files .isRegularFile (wdtVariablesPath )) {
368363 String wdtVariableFilename = wdtVariablesPath .getFileName ().toString ();
@@ -372,7 +367,7 @@ protected List<String> handleWdtArgsIfRequired(String tmpDir) throws IOException
372367 retVal .addAll (getWdtRequiredBuildArgs (wdtVariablesPath ));
373368 }
374369 }
375- logger .finer ( "Exiting CreateImage.handleWdtArgsIfRequired: " );
370+ logger .exiting ( );
376371 return retVal ;
377372 }
378373
@@ -561,6 +556,14 @@ private void addWdtUrl(String wdtKey) throws Exception {
561556 )
562557 private String wdtJavaOptions ;
563558
559+
560+ @ Option (
561+ names = {"--wdtModelOnly" },
562+ description = "Install WDT and copy the models to the image, but do not create the domain. "
563+ + "Default: ${DEFAULT-VALUE}."
564+ )
565+ private boolean wdtModelOnly = false ;
566+
564567 @ Unmatched
565568 List <String > unmatchedOptions ;
566569}
0 commit comments