-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.coreagent
30 lines (25 loc) · 1.38 KB
/
Dockerfile.coreagent
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
# escape=`
ARG BASE
FROM mcr.microsoft.com/windows/servercore:$BASE
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ARG AZP_TOKEN
ARG AZP_URL
WORKDIR /azp
RUN New-Item \"\azp\agent\" -ItemType directory | Out-Null; `
Set-Location agent; `
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(\":$env:AZP_TOKEN\")); `
$url = \"$ENV:AZP_URL/_apis/distributedtask/packages/agent?platform=win-x64&`$top=1\"; `
$package = Invoke-RestMethod -Headers @{Authorization=(\"Basic $base64AuthInfo\")} $url; `
$packageUrl = $package[0].Value.downloadUrl; `
Write-Host \"Downloading $packageUrl\"; `
$wc = New-Object System.Net.WebClient; `
$wc.DownloadFile($packageUrl, \"$(Get-Location)\agent.zip\"); `
Expand-Archive -Path 'agent.zip' -DestinationPath '\azp\agent'
RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); `
choco install -y docker-cli dotnetcore-sdk dotnet-6.0-sdk jq azure-cli; `
choco install -y dotnet-sdk --pre; `
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null; `
Set-PSRepository -Name 'PSGallery' -SourceLocation "https://www.powershellgallery.com/api/v2" -InstallationPolicy Trusted | Out-Null; `
Install-Module -Name 7Zip4PowerShell -Force | Out-Null
COPY start.ps1 .
CMD ["powershell", "-Command", "./start.ps1"]