Skip to content

Commit

Permalink
feat: allow to specify version of base Windows image
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Nov 19, 2020
1 parent d4d8390 commit 7b69a34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Only `image` parameter is mandatory - it's name of the resulting image.
volumes = ['/my-folder'] // list of volumes; default: empty
baseImage = 'my-org/our-base-image:1.2.3' // default: automatically choosed the best based on current Docker platform and Java version
javaVersion = JavaVersion.VERSION_1_8 // Java version used to choose appropriate base Docker image; default: project.targetCompatibility
windowsBaseImageSpecifier = 'windowsservercore-ltsc2016' // suffix of AdoptOpenJDK Docker image that will be used as base image; another option is 'windowsservercore-1809'
dockerfileLines = ['RUN apt-get ...'] // additional lines to include to Dockerfile; default: empty
arguments = ['--server'] // arguments to be passed to your application; default: empty
dockerBuildDirectory = project.file('my-directory') // directory where Dockerfile is created; default: "$buildDir/dockerJava"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DistDockerTask extends DefaultTask {
}

private String getWindowsBaseImage() {
getAdoptOpenJdkBaseImageNamePrefix() + '-windowsservercore-ltsc2016'
getAdoptOpenJdkBaseImageNamePrefix() + (settings.windowsBaseImageSpecifier ? ('-' + settings.windowsBaseImageSpecifier) : '')
}

private String getLinuxBaseImage() {
Expand Down Expand Up @@ -189,6 +189,8 @@ interface DistDockerSettings {
@Input @Optional
JavaVersion getJavaVersion()
@Input @Optional
String getWindowsBaseImageSpecifier()
@Input @Optional
String getBaseImage()
@Input @Optional
Integer[] getPorts()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class DockerJavaExtension implements DistDockerSettings, DockerPushSettings {
JavaVersion getJavaVersion() { customJavaVersion ?: project.targetCompatibility }
void setJavaVersion(JavaVersion version) { customJavaVersion = version }
private JavaVersion customJavaVersion
String windowsBaseImageSpecifier = 'windowsservercore-ltsc2016'
String baseImage
Integer[] ports = []
String[] volumes = []
Expand Down

0 comments on commit 7b69a34

Please sign in to comment.