forked from JetBrains/teamcity-docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
112 lines (91 loc) · 5.14 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Default arguments
ARG dotnetWindowsComponent='https://dotnetcli.blob.core.windows.net/dotnet/Sdk/3.1.413/dotnet-sdk-3.1.413-win-x64.zip'
ARG dotnetWindowsComponentSHA512='1fe3beb2e033c557c1577452f341121c1a8b2520b8bc80c2e1291d382964aeef7bfbc3e7b55c9130b934fb89aa6cbf1354cf625b3b1dada1bde3443b43ca2359'
ARG gitWindowsComponent='https://github.com/git-for-windows/git/releases/download/v2.33.0.windows.2/MinGit-2.33.0.2-64-bit.zip'
ARG gitWindowsComponentSHA256='e28968ddd1c928eec233e0c692a90d6ac41eb7b53a9d7a408c13cb5b613afa95'
ARG jdkWindowsComponent='https://corretto.aws/downloads/resources/11.0.12.7.1/amazon-corretto-11.0.12.7.1-windows-x64-jdk.zip'
ARG jdkWindowsComponentMD5SUM='022bf679bc9c337287859264496c2f38'
ARG mercurialWindowsComponent='https://www.mercurial-scm.org/release/windows/mercurial-5.9.1-x64.msi'
ARG teamcityMinimalAgentImage='teamcity-minimal-agent:EAP-nanoserver-1903'
ARG windowsservercoreImage='mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-1903'
# The list of required arguments
# ARG windowsservercoreImage
# ARG dotnetWindowsComponent
# ARG dotnetWindowsComponentSHA512
# ARG jdkWindowsComponent
# ARG jdkWindowsComponentMD5SUM
# ARG gitWindowsComponent
# ARG gitWindowsComponentSHA256
# ARG mercurialWindowsComponentName
# ARG teamcityMinimalAgentImage
FROM ${teamcityMinimalAgentImage} AS buildagent
ARG windowsservercoreImage
FROM ${windowsservercoreImage}
COPY scripts/*.cs /scripts/
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG dotnetWindowsComponent
ARG dotnetWindowsComponentSHA512
ARG jdkWindowsComponent
ARG jdkWindowsComponentMD5SUM
ARG gitWindowsComponent
ARG gitWindowsComponentSHA256
ARG mercurialWindowsComponent
RUN [Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11, tls' ; \
$code = Get-Content -Path "scripts/Web.cs" -Raw ; \
Add-Type -TypeDefinition "$code" -Language CSharp ; \
$downloadScript = [Scripts.Web]::DownloadFiles($Env:jdkWindowsComponent + '#MD5#' + $Env:jdkWindowsComponentMD5SUM, 'jdk.zip', $Env:gitWindowsComponent + '#SHA256#' + $Env:gitWindowsComponentSHA256, 'git.zip', $Env:mercurialWindowsComponent, 'hg.msi', $Env:dotnetWindowsComponent + '#SHA512#' + $Env:dotnetWindowsComponentSHA512, 'dotnet.zip') ; \
Remove-Item -Force -Recurse $Env:ProgramFiles\dotnet; \
Expand-Archive dotnet.zip -Force -DestinationPath $Env:ProgramFiles\dotnet; \
Remove-Item -Force dotnet.zip; \
Get-ChildItem -Path $Env:ProgramFiles\dotnet -Include *.lzma -File -Recurse | foreach { $_.Delete()}; \
Expand-Archive jdk.zip -DestinationPath $Env:ProgramFiles\Java ; \
Get-ChildItem $Env:ProgramFiles\Java | Rename-Item -NewName "OpenJDK" ; \
Remove-Item $Env:ProgramFiles\Java\OpenJDK\lib\src.zip -Force ; \
Remove-Item -Force jdk.zip ; \
$gitPath = $Env:ProgramFiles + '\Git'; \
Expand-Archive git.zip -DestinationPath $gitPath ; \
Remove-Item -Force git.zip ; \
# avoid circular dependencies in gitconfig
$gitConfigFile = $gitPath + '\etc\gitconfig'; \
$configContent = Get-Content $gitConfigFile; \
$configContent = $configContent.Replace('path = C:/Program Files/Git/etc/gitconfig', ''); \
Set-Content $gitConfigFile $configContent; \
Start-Process msiexec -Wait -ArgumentList /q, /i, hg.msi ; \
Remove-Item -Force hg.msi
COPY --from=buildagent /BuildAgent /BuildAgent
EXPOSE 9090
VOLUME C:/BuildAgent/conf
CMD ./BuildAgent/run-agent.ps1
# Configuration file for TeamCity agent
ENV CONFIG_FILE="C:/BuildAgent/conf/buildAgent.properties" \
# Java home directory
JAVA_HOME="C:\Program Files\Java\OpenJDK" \
# Opt out of the telemetry feature
DOTNET_CLI_TELEMETRY_OPTOUT=true \
# Disable first time experience
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true \
# Configure Kestrel web server to bind to port 80 when present
ASPNETCORE_URLS=http://+:80 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
# Enable correct mode for dotnet watch (only mode supported in a container)
DOTNET_USE_POLLING_FILE_WATCHER=true \
# Skip extraction of XML docs - generally not useful within an image/container - helps perfomance
NUGET_XMLDOC_MODE=skip
USER ContainerAdministrator
RUN setx /M PATH ('{0};{1}\bin;C:\Program Files\Git\cmd;C:\Program Files\Mercurial' -f $env:PATH, $env:JAVA_HOME)
#--> yaak changes for installing minimal build dependencies
#install perforce command line client
RUN curl.exe -L https://www.perforce.com/downloads/perforce/r21.2/bin.ntx64/helix-p4-x64.exe --output helix-p4-x64.exe; \
Start-Process helix-p4-x64.exe -Wait -ArgumentList /s, /norestart ; \
Remove-Item -Force helix-p4-x64.exe
#install minimal build environment
RUN curl.exe -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe; \
Start-Process vs_buildtools.exe -Wait -ArgumentList --quiet, --wait, --norestart, --nocache, modify, --add, "Microsoft.Net.Component.4.6.2.TargetingPack" ; \
Remove-Item -Force vs_buildtools.exe
#set AutoSDK path
RUN setx /M UE_SDKS_ROOT C:\AutoSDK
#set default server url
ENV SERVER_URL https://yaak.teamcity.com
#<-- yaak changes for installing minimal build dependencies
USER ContainerUser