-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #775 from xlight05/remove-windows-containers
Remove windows container support
- Loading branch information
Showing
6 changed files
with
4 additions
and
168 deletions.
There are no files selected for viewing
108 changes: 0 additions & 108 deletions
108
...-plugin-tests/src/test/java/io/ballerina/c2c/test/docker/DockerGeneratorWindowsTests.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,11 +70,7 @@ public void createArtifacts(PrintStream outStream, String logAppender, Path jarF | |
outputDir.resolve(this.dockerModel.getFatJarPath().getFileName())); | ||
} else { | ||
String dockerContent; | ||
if (!isWindowsBuild()) { | ||
dockerContent = generateDockerfile(); | ||
} else { | ||
dockerContent = generateThinJarWindowsDockerfile(); | ||
} | ||
dockerContent = generateDockerfile(); | ||
copyNativeJars(outputDir); | ||
DockerGenUtils.writeToFile(dockerContent, outputDir.resolve("Dockerfile")); | ||
Path jarLocation = outputDir.resolve(DockerGenUtils.extractJarName(jarFilePath) + EXECUTABLE_JAR); | ||
|
@@ -241,48 +237,6 @@ protected void appendUser(StringBuilder dockerfileContent) { | |
} | ||
} | ||
|
||
private String generateThinJarWindowsDockerfile() { | ||
final String separator = "\\"; | ||
StringBuilder dockerfileContent = new StringBuilder(); | ||
dockerfileContent.append("# Auto Generated Dockerfile").append(LINE_SEPARATOR); | ||
dockerfileContent.append("FROM ").append(this.dockerModel.getBaseImage()).append(LINE_SEPARATOR); | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
dockerfileContent.append("LABEL maintainer=\"[email protected]\"").append(LINE_SEPARATOR); | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
dockerfileContent.append("WORKDIR ").append(getWorkDir()).append(LINE_SEPARATOR); | ||
|
||
for (Path path : this.dockerModel.getDependencyJarPaths()) { | ||
dockerfileContent.append("COPY ").append(path.getFileName()).append(getWorkDir()) | ||
.append("jars").append(separator); | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
} | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
appendCommonCommands(dockerfileContent); | ||
if (isBlank(this.dockerModel.getEntryPoint())) { | ||
PackageID packageID = this.dockerModel.getPkgId(); | ||
String mainClass = JarResolver.getQualifiedClassName(packageID.orgName.value, packageID.name.value, | ||
packageID.version.value, MODULE_INIT_CLASS_NAME); | ||
mainClass = "'" + mainClass + "'"; | ||
if (this.dockerModel.isEnableDebug()) { | ||
dockerfileContent.append("CMD java -Xdiag -agentlib:jdwp=transport=dt_socket,server=y,suspend=n," + | ||
"address=*:").append(this.dockerModel.getDebugPort()).append(" -cp \"") | ||
.append(this.dockerModel.getJarFileName()).append(":jars/*\" ").append(mainClass); | ||
} else { | ||
dockerfileContent.append("CMD java -Xdiag -cp \"").append(this.dockerModel.getJarFileName()) | ||
.append(":jars/*\" ").append(mainClass); | ||
} | ||
} else { | ||
dockerfileContent.append(this.dockerModel.getEntryPoint()); | ||
} | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
if (!isBlank(this.dockerModel.getCommandArg())) { | ||
dockerfileContent.append(this.dockerModel.getCommandArg()); | ||
} | ||
dockerfileContent.append(LINE_SEPARATOR); | ||
|
||
return dockerfileContent.toString(); | ||
} | ||
|
||
protected void appendCommonCommands(StringBuilder dockerfileContent) { | ||
this.dockerModel.getEnv().forEach((key, value) -> dockerfileContent.append("ENV "). | ||
append(key).append("=").append(value).append(LINE_SEPARATOR)); | ||
|
@@ -310,11 +264,7 @@ protected void appendCommonCommands(StringBuilder dockerfileContent) { | |
} | ||
} | ||
|
||
private boolean isWindowsBuild() { | ||
return Boolean.parseBoolean(System.getenv(DockerGenConstants.ENABLE_WINDOWS_BUILD)); | ||
} | ||
|
||
private String getWorkDir() { | ||
return isWindowsBuild() ? "C:\\ballerina\\home\\" : "/home/ballerina"; | ||
return "/home/ballerina"; | ||
} | ||
} |