-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.bcagent
32 lines (27 loc) · 1.45 KB
/
Dockerfile.bcagent
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
# escape=`
ARG BASE
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-$BASE
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
ENV BCCHVERSION 3.0.1
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 7zip.install; `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Install-PackageProvider -Name 'Nuget' -Force; `
Install-Module 'bccontainerhelper' -MinimumVersion $env:BCCHVERSION -MaximumVersion $env:BCCHVERSION -Force; `
Install-Module AzureDevOpsAPIUtils -Force -ErrorAction SilentlyContinue; `
Install-Module Az.ApplicationInsights -Force -ErrorAction SilentlyContinue;
COPY start.ps1 .
CMD .\start.ps1