Skip to content

Commit 312c0ba

Browse files
gosurya-oraclejshum2479
authored andcommitted
fix issues reported by rc
1 parent 06e7677 commit 312c0ba

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

src/main/java/com/oracle/weblogicx/imagebuilder/cli/menu/CreateImage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.nio.file.Files;
2222
import java.nio.file.Path;
2323
import java.nio.file.Paths;
24+
import java.nio.file.attribute.PosixFilePermissions;
2425
import java.time.Duration;
2526
import java.time.Instant;
2627
import java.util.LinkedList;
@@ -72,7 +73,7 @@ public CommandResponse call() throws Exception {
7273
// create a tmp directory for user.
7374
// using user home as base to avoid running out of space in tmp
7475
tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("user.home")),
75-
"wlsimgbuilder_temp");
76+
"wlsimgbuilder_temp", PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")));
7677
String tmpDirPath = tmpDir.toAbsolutePath().toString();
7778
logger.info("tmp directory used for build context: " + tmpDirPath);
7879
Path tmpPatchesDir = Files.createDirectory(Paths.get(tmpDirPath, "patches"));
@@ -86,7 +87,7 @@ public CommandResponse call() throws Exception {
8687
cmdBuilder.add("BASE_IMAGE=" + fromImage);
8788

8889
tmpDir2 = Files.createTempDirectory(Paths.get(System.getProperty("user.home")),
89-
"wlsimgbuilder_temp");
90+
"wlsimgbuilder_temp", PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")));
9091
logger.info("tmp directory in user.home for docker run: " + tmpDir2);
9192

9293
Utils.copyResourceAsFile("/probe-env/test-create-env.sh",

src/main/java/com/oracle/weblogicx/imagebuilder/cli/menu/UpdateImage.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import com.oracle.weblogicx.imagebuilder.api.model.CommandResponse;
88
import com.oracle.weblogicx.imagebuilder.api.model.WLSInstallerType;
9-
import com.oracle.weblogicx.imagebuilder.cli.HelpVersionProvider;
109
import com.oracle.weblogicx.imagebuilder.util.ARUUtil;
1110
import com.oracle.weblogicx.imagebuilder.util.Constants;
1211
import com.oracle.weblogicx.imagebuilder.util.Utils;
@@ -18,6 +17,7 @@
1817
import java.nio.file.Files;
1918
import java.nio.file.Path;
2019
import java.nio.file.Paths;
20+
import java.nio.file.attribute.PosixFilePermissions;
2121
import java.time.Duration;
2222
import java.time.Instant;
2323
import java.util.ArrayList;
@@ -71,7 +71,8 @@ public CommandResponse call() throws Exception {
7171
cmdBuilder.add("BASE_IMAGE=" + fromImage);
7272
}
7373

74-
tmpDir2 = Files.createTempDirectory(Paths.get(System.getProperty("user.home")), null);
74+
tmpDir2 = Files.createTempDirectory(Paths.get(System.getProperty("user.home")), "wlsimgbuilder_temp",
75+
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")));
7576
logger.info("tmp directory in user.home for docker run: " + tmpDir2);
7677
Utils.copyResourceAsFile("/probe-env/test-update-env.sh",
7778
tmpDir2.toAbsolutePath().toString() + File.separator + "test-env.sh", true);
@@ -130,7 +131,8 @@ public CommandResponse call() throws Exception {
130131
}
131132

132133
// create a tmp directory for user.
133-
tmpDir = Files.createTempDirectory(null);
134+
tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("user.home")), "wlsimgbuilder_temp",
135+
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxr-xr-x")));
134136
String tmpDirPath = tmpDir.toAbsolutePath().toString();
135137
Path tmpPatchesDir = Files.createDirectory(Paths.get(tmpDirPath, "patches"));
136138
Files.createFile(Paths.get(tmpPatchesDir.toAbsolutePath().toString(), "dummy.txt"));

src/main/java/com/oracle/weblogicx/imagebuilder/util/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public static List<String> getDockerRunCmd(Path hostDirToMount, String dockerIma
469469
String... args) {
470470
//docker run -v /user.dir/tmpdir:/tmp wls122130:min sh -c /tmp/test-env.sh
471471
final List<String> retVal = Stream.of(
472-
"docker", "run", "--volume=" + hostDirToMount.toAbsolutePath().toString() + ":/tmp_scripts",
472+
"docker", "run", "--user=root", "--volume=" + hostDirToMount.toAbsolutePath().toString() + ":/tmp_scripts",
473473
dockerImage, "/tmp_scripts/" + scriptToRun).collect(Collectors.toList());
474474
if (args != null && args.length > 0) {
475475
retVal.addAll(Arrays.asList(args));

src/main/resources/docker-files/Dockerfile.ph

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ CMD ["sh", "-c", "${SCRIPT_HOME}/startAdminServer.sh"]
9393
RUN mkdir -p $OTMPDIR/opatch
9494
COPY --chown=oracle:oracle p28186730_139400_Generic.zip $OTMPDIR/opatch/
9595

96-
RUN unzip $OTMPDIR/opatch/p28186730_139400_Generic.zip -d $OTMPDIR/opatch ; \
97-
/u01/jdk/bin/java -jar $OTMPDIR/opatch/6880880/opatch_generic.jar -silent -invPtrLoc $INV_LOC/$ORAINST \
98-
oracle_home=$ORACLE_HOME
96+
RUN cd $OTMPDIR/opatch \
97+
&& jar -xf $OTMPDIR/opatch/p28186730_139400_Generic.zip \
98+
&& $JAVA_HOME/bin/java -jar $OTMPDIR/opatch/6880880/opatch_generic.jar -silent oracle_home=$ORACLE_HOME
9999

100100
# END %%OPATCH_1394%% #
101101

src/main/resources/docker-files/Dockerfile.update

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ ARG PATCHDIR
1313
ARG OTMPDIR
1414

1515
ENV PATCHDIR=${PATCHDIR:-patches} \
16-
OTMPDIR=${OTMPDIR:-/tmp/delme}
16+
OTMPDIR=${OTMPDIR:-/tmp/delme} \
17+
OPATCH_NO_FUSER=true
1718

1819
RUN mkdir -p $OTMPDIR \
1920
&& chown -R oracle:oracle $OTMPDIR/

0 commit comments

Comments
 (0)