Last active
September 5, 2019 14:54
-
-
Save rohancme/ac55b33f01020b0a129460d1422ac940 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FROM microsoft/windowsservercore | |
# Specify a public IP here so the build machine can download slave.jar | |
ARG BASE_URL | |
# Specify the internal Kubernetes service IP Address here | |
ARG JENKINS_JNLP_URL | |
ARG JENKINS_SECRET | |
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | |
# Install jre and add to PATH | |
# Do not recommend pushing the image to a public repository due to Oracle's EULA: http://www.oracle.com/technetwork/java/javase/documentation/index.html | |
RUN wget 'http://javadl.oracle.com/webapps/download/AutoDL?BundleId=210185' -Outfile 'C:\jreinstaller.exe' ; \ | |
Start-Process -filepath C:\jreinstaller.exe -passthru -wait -argumentlist "/s,INSTALLDIR=c:\Java\jre1.8.0_91" ; \ | |
del C:\jreinstaller.exe | |
ENV JAVA_HOME c:\\Java\\jre1.8.0_91 | |
RUN setx PATH %PATH%;%JAVA_HOME%\bin | |
RUN (New-Object System.Net.WebClient).DownloadFile('{0}/jnlpJars/slave.jar' -f $env:BASE_URL, 'slave.jar') ; | |
ENTRYPOINT C:\Java\jre1.8.0_91\bin\java.exe -jar C:\slave.jar -jnlpUrl $Env:JENKINS_JNLP_URL -secret $Env:JENKINS_SECRET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a issue when build up this image:
SUCCESS: Specified value was saved.
%JAVA_HOME%\bin : The module '%JAVA_HOME%' could not be loaded. For more
information, run 'Import-Module %JAVA_HOME%'.
At line:1 char:93
entContainsErrorRecordException
The command 'powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; setx PATH %PATH%;%JAVA_HOME%\bin' returned a non-zero code: 1