11FROM mcr.microsoft.com/windows/servercore:ltsc2022
2+ SHELL ["powershell" ]
3+
24
35ARG SCUBAGEAR_VERSION=1.5.0
6+ ARG OPA_VERSION=1.3.0
47# Get static URL for current version: curl -s -D- https://aka.ms/downloadazcopy-v10-windows | grep ^Location
58# https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?tabs=dnf#obtain-a-static-download-link
69ARG AZCOPY_URL=https://azcopyvnext-awgzd8g7aagqhzhe.b02.azurefd.net/releases/release-10.29.0-20250428/azcopy_windows_amd64_10.29.0.zip
@@ -10,15 +13,22 @@ LABEL scubagear_version=${SCUBAGEAR_VERSION}
1013WORKDIR /app
1114
1215# download azcopy exe to workdir
13- RUN powershell Invoke-WebRequest -Uri % AZCOPY_URL% -OutFile AzCopy.zip -UseBasicParsing
14- RUN powershell Expand-Archive .\A zCopy.zip ./AzCopy -Force
15- RUN powershell $item = Get-ChildItem .\A zCopy\*\a zcopy.exe; Move-Item -Path $item -Destination .
16- RUN powershell Remove-Item AzCopy.zip; Remove-Item -r .\A zCopy
16+ RUN $ProgressPreference = 'SilentlyContinue' ; Invoke-WebRequest -Uri $Env: AZCOPY_URL -OutFile AzCopy.zip -UseBasicParsing
17+ RUN Expand-Archive .\A zCopy.zip ./AzCopy -Force
18+ RUN $item = Get-ChildItem .\A zCopy\*\a zcopy.exe; Move-Item -Path $item -Destination .
19+ RUN Remove-Item AzCopy.zip; Remove-Item -r .\A zCopy
1720
1821# Needed for setup module installs
19- RUN powershell Install-PackageProvider -Name NuGet -Force
20- RUN powershell Install-Module -Name ScubaGear -RequiredVersion % SCUBAGEAR_VERSION% -Force
21- RUN powershell Initialize-SCuBA
22+ RUN Install-PackageProvider -Name NuGet -Force
23+ RUN Install-Module -Name ScubaGear -RequiredVersion $Env: SCUBAGEAR_VERSION -Force
24+ RUN Initialize-SCuBA -Scope AllUsers -NoOPA
2225COPY run_container.ps1 .
2326
27+ # manually install OPA, grant ContainerUser execute permissions, then switch to user
28+ ENV OPA_NAME="opa_windows_amd64.exe"
29+ RUN $ProgressPreference = 'SilentlyContinue' ; Invoke-WebRequest -Uri https://openpolicyagent.org/downloads/v$($Env:OPA_VERSION)/opa_windows_amd64.exe -OutFile $Env:OPA_NAME -UseBasicParsing
30+ RUN if ((Get-FileHash $Env:OPA_NAME -Algorithm SHA256).Hash -ne ([System.Text.Encoding]::ASCII.GetString((Invoke-WebRequest -Uri https://openpolicyagent.org/downloads/v$($Env:OPA_VERSION)/opa_windows_amd64.exe.sha256 -UseBasicParsing).Content) -split ' ' )[0]) { exit 1 }
31+ RUN icacls.exe $env:OPA_NAME /grant 'User Manager\C ontainerUser:RX'
32+ USER ContainerUser
33+
2434CMD [ "powershell" , ".\\ run_container.ps1" ]
0 commit comments