Skip to content

Commit b4d2a78

Browse files
authored
allow WDT installer name to be other than weblogic-deploy.zip (#118)
1 parent fcc17d6 commit b4d2a78

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public CommandResponse call() throws Exception {
6464

6565
List<String> cmdBuilder = getInitialBuildCmd();
6666
// build wdt args if user passes --wdtModelPath
67-
cmdBuilder.addAll(wdtOptions.handleWdtArgsIfRequired(dockerfileOptions, tmpDir, installerType));
67+
wdtOptions.handleWdtArgsIfRequired(dockerfileOptions, tmpDir, installerType);
6868

6969
// resolve required patches
7070
cmdBuilder.addAll(handlePatchFiles(null));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public CommandResponse call() throws Exception {
137137
List<String> cmdBuilder = getInitialBuildCmd();
138138

139139
// build wdt args if user passes --wdtModelPath
140-
cmdBuilder.addAll(wdtOptions.handleWdtArgsIfRequired(dockerfileOptions, tmpDir, installerType));
140+
wdtOptions.handleWdtArgsIfRequired(dockerfileOptions, tmpDir, installerType);
141141
dockerfileOptions.setWdtCommand(wdtOperation);
142142

143143
// resolve required patches

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,15 @@ public class WdtOptions {
3232

3333
/**
3434
* Checks whether the user requested a domain to be created with WDT.
35-
* If so, returns the required build args to pass to docker and creates required file links to pass
36-
* the model, archive, variables file to build process
35+
* If so, creates required file links to pass the model, archive, variables file to build process.
3736
*
3837
* @param tmpDir the tmp directory which is passed to docker as the build context directory
39-
* @return list of build args
4038
* @throws IOException in case of error
4139
*/
42-
List<String> handleWdtArgsIfRequired(DockerfileOptions dockerfileOptions, String tmpDir,
40+
void handleWdtArgsIfRequired(DockerfileOptions dockerfileOptions, String tmpDir,
4341
FmwInstallerType installerType) throws IOException {
4442
logger.entering(tmpDir);
4543

46-
List<String> retVal = new LinkedList<>();
4744
if (wdtModelPath != null) {
4845
dockerfileOptions.setWdtEnabled();
4946
dockerfileOptions.setWdtModelOnly(wdtModelOnly);
@@ -80,10 +77,10 @@ List<String> handleWdtArgsIfRequired(DockerfileOptions dockerfileOptions, String
8077
dockerfileOptions.setWdtStrictValidation(wdtStrictValidation);
8178

8279
CachedFile wdtInstaller = new CachedFile(InstallerType.WDT, wdtVersion);
83-
wdtInstaller.copyFile(cacheStore, tmpDir);
80+
Path wdtfile = wdtInstaller.copyFile(cacheStore, tmpDir);
81+
dockerfileOptions.setWdtInstallerFilename(wdtfile.getFileName().toString());
8482
}
8583
logger.exiting();
86-
return retVal;
8784
}
8885

8986
/**

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class DockerfileOptions {
6262
private boolean wdtModelOnly;
6363
private boolean wdtRunRcu;
6464
private boolean wdtStrictValidation;
65+
private String wdtInstallerFilename;
6566

6667
// Additional Build Commands
6768
private Map<String,List<String>> additionalBuildCommands;
@@ -667,6 +668,15 @@ public DockerfileOptions setWdtModelOnly(boolean value) {
667668
return this;
668669
}
669670

671+
@SuppressWarnings("unused")
672+
public String wdtInstaller() {
673+
return wdtInstallerFilename;
674+
}
675+
676+
public void setWdtInstallerFilename(String value) {
677+
wdtInstallerFilename = value;
678+
}
679+
670680
public boolean modelOnly() {
671681
return wdtModelOnly;
672682
}

imagetool/src/main/resources/docker-files/Create_Image.mustache

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
33
#
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
#
@@ -124,14 +124,11 @@ RUN {{{oracle_home}}}/OPatch/opatch napply -silent -oh {{{oracle_home}}} -phBase
124124
FROM WLS_BUILD as WDT_BUILD
125125
LABEL com.oracle.weblogic.imagetool.buildid="{{buildId}}"
126126

127-
ARG WDT_PKG
128-
129-
ENV WDT_PKG=${WDT_PKG:-weblogic-deploy.zip} \
130-
WLSDEPLOY_PROPERTIES="{{wlsdeploy_properties}} -Djava.security.egd=file:/dev/./urandom" \
127+
ENV WLSDEPLOY_PROPERTIES="{{wlsdeploy_properties}} -Djava.security.egd=file:/dev/./urandom" \
131128
LC_ALL=${DEFAULT_LOCALE:-en_US.UTF-8} \
132129
DOMAIN_HOME={{{domain_home}}}
133130

134-
COPY --chown={{userid}}:{{groupid}} ${WDT_PKG} {{{tempDir}}}/
131+
COPY --chown={{userid}}:{{groupid}} {{{wdtInstaller}}} {{{tempDir}}}/
135132

136133
RUN mkdir -p {{{wdt_home}}} \
137134
&& chown {{userid}}:{{groupid}} {{{wdt_home}}}
@@ -158,7 +155,7 @@ RUN {{{oracle_home}}}/OPatch/opatch napply -silent -oh {{{oracle_home}}} -phBase
158155
{{{.}}}
159156
{{/beforeWdtCommand}}
160157

161-
RUN unzip -q {{{tempDir}}}/$WDT_PKG -d {{{wdt_home}}} \
158+
RUN unzip -q {{{tempDir}}}/{{{wdtInstaller}}} -d {{{wdt_home}}} \
162159
&& cd {{{wdt_home}}}/weblogic-deploy/bin \
163160
{{^modelOnly}}
164161
&& ./createDomain.sh \

imagetool/src/main/resources/docker-files/Rebase_Image.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
33
#
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
#

imagetool/src/main/resources/docker-files/Update_Image.mustache

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
33
#
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
#
@@ -8,17 +8,14 @@
88
FROM {{baseImage}} as WDT_BUILD
99
LABEL com.oracle.weblogic.imagetool.buildid="{{buildId}}"
1010

11-
ARG WDT_PKG
12-
13-
ENV WDT_PKG=${WDT_PKG:-weblogic-deploy.zip} \
14-
WLSDEPLOY_PROPERTIES={{wlsdeploy_properties}} \
11+
ENV WLSDEPLOY_PROPERTIES={{wlsdeploy_properties}} \
1512
LC_ALL=${DEFAULT_LOCALE:-en_US.UTF-8} \
1613
DOMAIN_HOME={{{domain_home}}} \
1714
PATH=${PATH}:{{{java_home}}}/bin:{{{oracle_home}}}/oracle_common/common/bin:{{{oracle_home}}}/wlserver/common/bin:{{{domain_home}}}/bin:{{{oracle_home}}}
1815

1916
USER root
2017

21-
COPY --chown={{userid}}:{{groupid}} ${WDT_PKG} {{{tempDir}}}/
18+
COPY --chown={{userid}}:{{groupid}} {{{wdtInstaller}}} {{{tempDir}}}/
2219

2320
RUN mkdir -p {{{wdt_home}}} \
2421
&& chown {{userid}}:{{groupid}} {{{wdt_home}}}
@@ -46,7 +43,7 @@
4643
{{/beforeWdtCommand}}
4744

4845
RUN cd {{{wdt_home}}} \
49-
&& jar xf {{{tempDir}}}/$WDT_PKG
46+
&& jar xf {{{tempDir}}}/{{{wdtInstaller}}}
5047

5148
{{^modelOnly}}
5249
RUN cd {{{wdt_home}}} \

0 commit comments

Comments
 (0)