From 9f0eb9c446d54fdc1257ba131f07dd263bad76d1 Mon Sep 17 00:00:00 2001 From: Andrey Koltsov Date: Fri, 24 Nov 2023 19:02:36 +0100 Subject: [PATCH] [TCQA] Remove unused file. --- .../WindowsServerCore1803.Dockerfile | 2 +- .../WindowsServerCore2022.Dockerfile | 2 +- .../Agent/windowsservercore/1803/Dockerfile | 2 +- .../Agent/windowsservercore/1809/Dockerfile | 2 +- .../Agent/windowsservercore/1903/Dockerfile | 2 +- .../Agent/windowsservercore/1909/Dockerfile | 2 +- .../Agent/windowsservercore/2004/Dockerfile | 98 +++++++++++++++++++ .../Agent/windowsservercore/2022/Dockerfile | 2 +- 8 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 context/generated/windows/Agent/windowsservercore/2004/Dockerfile diff --git a/configs/windows/Agent/windowsservercore/WindowsServerCore1803.Dockerfile b/configs/windows/Agent/windowsservercore/WindowsServerCore1803.Dockerfile index e51e0e5d..6bfe907b 100644 --- a/configs/windows/Agent/windowsservercore/WindowsServerCore1803.Dockerfile +++ b/configs/windows/Agent/windowsservercore/WindowsServerCore1803.Dockerfile @@ -79,7 +79,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile b/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile index 91ce1185..f869e1ee 100644 --- a/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile +++ b/configs/windows/Agent/windowsservercore/WindowsServerCore2022.Dockerfile @@ -83,7 +83,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/context/generated/windows/Agent/windowsservercore/1803/Dockerfile b/context/generated/windows/Agent/windowsservercore/1803/Dockerfile index 270239ce..d49dfb92 100644 --- a/context/generated/windows/Agent/windowsservercore/1803/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/1803/Dockerfile @@ -74,7 +74,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/context/generated/windows/Agent/windowsservercore/1809/Dockerfile b/context/generated/windows/Agent/windowsservercore/1809/Dockerfile index 660a974b..b92b09db 100644 --- a/context/generated/windows/Agent/windowsservercore/1809/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/1809/Dockerfile @@ -74,7 +74,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/context/generated/windows/Agent/windowsservercore/1903/Dockerfile b/context/generated/windows/Agent/windowsservercore/1903/Dockerfile index b81bc85c..6d7de13b 100644 --- a/context/generated/windows/Agent/windowsservercore/1903/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/1903/Dockerfile @@ -74,7 +74,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/context/generated/windows/Agent/windowsservercore/1909/Dockerfile b/context/generated/windows/Agent/windowsservercore/1909/Dockerfile index 7a4f7466..310af06a 100644 --- a/context/generated/windows/Agent/windowsservercore/1909/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/1909/Dockerfile @@ -74,7 +74,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \ diff --git a/context/generated/windows/Agent/windowsservercore/2004/Dockerfile b/context/generated/windows/Agent/windowsservercore/2004/Dockerfile new file mode 100644 index 00000000..9f0b3d86 --- /dev/null +++ b/context/generated/windows/Agent/windowsservercore/2004/Dockerfile @@ -0,0 +1,98 @@ +# Default arguments +ARG dotnetWindowsComponent='https://dotnetcli.blob.core.windows.net/dotnet/Sdk/6.0.413/dotnet-sdk-6.0.413-win-x64.zip' +ARG dotnetWindowsComponentSHA512='a9e1bbb52484ad0667b258451ebb6b47ce6c7b788c015aee8a86c5e0c4dcf4ee8c82d796921869d64c92bb2afef2c7ceea09cfe255d8519d48f2471a098c361e' +ARG gitWindowsComponent='https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/MinGit-2.43.0-64-bit.zip' +ARG gitWindowsComponentSHA256='1905d93068e986258fafc69517df8fddff829bb2a289c1fa4dcc6cdf720ddf36' +ARG jdkWindowsComponent='https://corretto.aws/downloads/resources/17.0.7.7.1/amazon-corretto-17.0.7.7.1-windows-x64-jdk.zip' +ARG jdkWindowsComponentMD5SUM='feb7eab99c647a0b4347be9f0a3276de' +ARG mercurialWindowsComponent='https://www.mercurial-scm.org/release/windows/mercurial-5.9.1-x64.msi' +ARG teamcityMinimalAgentImage='teamcity-minimal-agent:2023.11-nanoserver-2004' +ARG windowsservercoreImage='mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004' + +# 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/ + +# PowerShell +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 -IgnoreWarnings -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; \ +# .NET 6.0, .NET Framework 4 is inherited from base image + 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()}; \ +# JDK + 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 ; \ +# Git + $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; \ +# Mercirual + 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 ["powershell", "./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) +USER ContainerUser diff --git a/context/generated/windows/Agent/windowsservercore/2022/Dockerfile b/context/generated/windows/Agent/windowsservercore/2022/Dockerfile index 6860cd50..152e3ed9 100644 --- a/context/generated/windows/Agent/windowsservercore/2022/Dockerfile +++ b/context/generated/windows/Agent/windowsservercore/2022/Dockerfile @@ -78,7 +78,7 @@ EXPOSE 9090 VOLUME C:/BuildAgent/conf -CMD ["pwsh", "./BuildAgent/run-agent.ps1"] +CMD ["powershell", "./BuildAgent/run-agent.ps1"] # Configuration file for TeamCity agent ENV CONFIG_FILE="C:\BuildAgent\conf\buildAgent.properties" \