@@ -67,7 +67,6 @@ public CommandResponse call() throws Exception {
67
67
}
68
68
69
69
List <String > cmdBuilder = getInitialBuildCmd ();
70
-
71
70
// create a tmp directory for user.
72
71
tmpDir = Files .createTempDirectory (null );
73
72
String tmpDirPath = tmpDir .toAbsolutePath ().toString ();
@@ -80,7 +79,6 @@ public CommandResponse call() throws Exception {
80
79
81
80
if (fromImage != null && !fromImage .isEmpty ()) {
82
81
cmdBuilder .add (BUILD_ARG );
83
- cmdBuilder .add ("BASE_IMAGE=" + fromImage );
84
82
85
83
tmpDir2 = Files .createTempDirectory (Paths .get (System .getProperty ("user.home" )), null );
86
84
logger .info ("tmp directory in user.home for docker run: " + tmpDir2 );
@@ -107,7 +105,6 @@ public CommandResponse call() throws Exception {
107
105
} else {
108
106
filterStartTags .add ("_YUM" );
109
107
}
110
-
111
108
// build wdt args if user passes --wdtModelPath
112
109
cmdBuilder .addAll (handleWDTArgsIfRequired (tmpDir ));
113
110
@@ -122,7 +119,6 @@ public CommandResponse call() throws Exception {
122
119
123
120
// add directory to pass the context
124
121
cmdBuilder .add (tmpDirPath );
125
-
126
122
logger .info ("docker cmd = " + String .join (" " , cmdBuilder ));
127
123
Utils .runDockerCommand (isCLIMode , cmdBuilder , dockerLog );
128
124
} catch (Exception ex ) {
@@ -154,9 +150,12 @@ private List<String> handleInstallerFiles(Path tmpDir) throws Exception {
154
150
for (InstallerFile eachInstaller : requiredInstallers ) {
155
151
String targetFilePath = eachInstaller .resolve (cacheStore );
156
152
File targetFile = new File (targetFilePath );
157
- Path targetLink = Files .createLink (Paths .get (tmpDirPath , targetFile .getName ()),
158
- Paths .get (targetFilePath ));
159
- retVal .addAll (eachInstaller .getBuildArg (tmpDir .relativize (targetLink ).toString ()));
153
+ try {
154
+ Path targetLink = Files .copy (Paths .get (targetFilePath ), Paths .get (tmpDirPath , targetFile .getName ()));
155
+ retVal .addAll (eachInstaller .getBuildArg (tmpDir .relativize (targetLink ).toString ()));
156
+ } catch (Exception ee ) {
157
+ ee .printStackTrace ();
158
+ }
160
159
}
161
160
return retVal ;
162
161
}
@@ -186,18 +185,23 @@ private List<String> handleWDTArgsIfRequired(Path tmpDir) throws IOException {
186
185
if (wdtModelPath != null ) {
187
186
if (Files .isRegularFile (wdtModelPath )) {
188
187
filterStartTags .add ("WDT_" );
189
- Path targetLink = Files .createLink (Paths .get (tmpDirPath , wdtModelPath .getFileName ().toString ()), wdtModelPath );
188
+ Path targetLink = Files .copy (wdtModelPath , Paths .get (tmpDirPath , wdtModelPath .getFileName ().toString ())
189
+ );
190
190
retVal .add (BUILD_ARG );
191
191
retVal .add ("WDT_MODEL=" + tmpDir .relativize (targetLink ).toString ());
192
192
193
193
if (wdtArchivePath != null && Files .isRegularFile (wdtArchivePath )) {
194
- targetLink = Files .createLink (Paths .get (tmpDirPath , wdtArchivePath .getFileName ().toString ()), wdtArchivePath );
194
+ targetLink = Files .copy (wdtArchivePath , Paths .get (tmpDirPath ,
195
+ wdtArchivePath .getFileName ().toString ())
196
+ );
195
197
retVal .add (BUILD_ARG );
196
198
retVal .add ("WDT_ARCHIVE=" + tmpDir .relativize (targetLink ).toString ());
197
199
}
198
200
199
201
if (wdtVariablesPath != null && Files .isRegularFile (wdtVariablesPath )) {
200
- targetLink = Files .createLink (Paths .get (tmpDirPath , wdtVariablesPath .getFileName ().toString ()), wdtVariablesPath );
202
+ targetLink = Files .copy (wdtVariablesPath , Paths .get (tmpDirPath ,
203
+ wdtVariablesPath .getFileName ().toString ())
204
+ );
201
205
retVal .add (BUILD_ARG );
202
206
retVal .add ("WDT_VARIABLE=" + tmpDir .relativize (targetLink ).toString ());
203
207
retVal .addAll (getWDTRequiredBuildArgs (wdtVariablesPath ));
0 commit comments