|
| 1 | +# escape=` |
| 2 | + |
1 | 3 | FROM microsoft/windowsservercore:10.0.14393.2312 |
2 | 4 | LABEL maintainer="xied75@gmail.com" |
3 | 5 |
|
4 | | -ENV JENKINS_VERSION=2.121.1 JENKINS_HOME=C:/JENKINS_HOME |
| 6 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
5 | 7 |
|
6 | | -EXPOSE 8080 50000 |
7 | | -VOLUME C:/JENKINS_HOME |
| 8 | +ENV JENKINS_VERSION=2.121.3 JENKINS_HOME=C:/JENKINS_HOME |
8 | 9 |
|
9 | 10 | COPY noStart.mst C:/ |
10 | 11 |
|
11 | | -RUN powershell -Command \ |
12 | | - Invoke-WebRequest -UseBasicParsing -Uri "https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.3/ServiceMonitor.exe" -OutFile \ServiceMonitor.exe; \ |
13 | | - Invoke-WebRequest http://mirrors.jenkins-ci.org/windows-stable/jenkins-%JENKINS_VERSION%.zip -OutFile \jenkins-%JENKINS_VERSION%.zip; \ |
14 | | - Expand-Archive -Path \jenkins-%JENKINS_VERSION%.zip -DestinationPath /; \ |
15 | | - Start-Process -FilePath msiexec.exe -ArgumentList /i, jenkins.msi, TRANSFORMS=noStart.mst, /qn, /L, jenkins.install.log -PassThru -Wait; \ |
16 | | - rm \jenkins-%JENKINS_VERSION%.zip; \ |
17 | | - rm \jenkins.msi; \ |
18 | | - rm \noStart.mst; \ |
19 | | - $xml = (Get-Content \"%ProgramFiles(x86)%\Jenkins\Jenkins.xml\") -as [Xml]; \ |
20 | | - $xml.service.env.value = \"%JENKINS_HOME%\"; \ |
21 | | - $xml.Save(\"%ProgramFiles(x86)%\Jenkins\Jenkins.xml\"); |
| 12 | +RUN ` |
| 13 | + # Install Portable Git |
| 14 | + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ` |
| 15 | + Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.18.0.windows.1/PortableGit-2.18.0-64-bit.7z.exe -OutFile PortableGit-2.18.0-64-bit.7z.exe; ` |
| 16 | + Start-Process -FilePath PortableGit-2.18.0-64-bit.7z.exe -ArgumentList '-y', '-InstallPath="C:\\PortableGit"' -NoNewWindow -PassThru -Wait; ` |
| 17 | + Remove-Item PortableGit-2.18.0-64-bit.7z.exe; ` |
| 18 | + # Set Path |
| 19 | + setx /M PATH $(${Env:PATH} ` |
| 20 | + + \";C:\PortableGit\bin\"); ` |
| 21 | + Invoke-WebRequest -UseBasicParsing -Uri "https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.3/ServiceMonitor.exe" -OutFile \ServiceMonitor.exe; ` |
| 22 | + Invoke-WebRequest http://mirrors.jenkins-ci.org/windows-stable/jenkins-$Env:JENKINS_VERSION.zip -OutFile \jenkins-$Env:JENKINS_VERSION.zip; ` |
| 23 | + Expand-Archive -Path \jenkins-$Env:JENKINS_VERSION.zip -DestinationPath /; ` |
| 24 | + Start-Process -FilePath msiexec.exe -ArgumentList /i, jenkins.msi, TRANSFORMS=noStart.mst, /qn, /L, jenkins.install.log -PassThru -Wait -NoNewWindow; ` |
| 25 | + Remove-Item \jenkins-$Env:JENKINS_VERSION.zip; ` |
| 26 | + Remove-Item \jenkins.msi; ` |
| 27 | + Remove-Item \noStart.mst; ` |
| 28 | + $xml = (Get-Content \"${Env:ProgramFiles(x86)}\Jenkins\Jenkins.xml\") -as [Xml]; ` |
| 29 | + $xml.service.env.value = \"$Env:JENKINS_HOME\"; ` |
| 30 | + $xml.Save(\"${Env:ProgramFiles(x86)}\Jenkins\Jenkins.xml\"); |
| 31 | + |
| 32 | +EXPOSE 8080 50000 |
| 33 | +VOLUME $JENKINS_HOME |
22 | 34 |
|
23 | 35 | ENTRYPOINT ["C:\\ServiceMonitor.exe", "jenkins"] |
0 commit comments