Instantly share code, notes, and snippets.

Embed
What would you like to do?
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