|
1 | 1 | FROM mcr.microsoft.com/windows/servercore:ltsc2022 |
| 2 | +SHELL ["powershell"] |
| 3 | + |
2 | 4 |
|
3 | 5 | ARG SCUBAGEAR_VERSION=1.5.0 |
4 | | -# How URL is obtained for specific version: |
| 6 | +ARG OPA_VERSION=1.3.0 |
| 7 | +# Get static URL for current version: curl -s -D- https://aka.ms/downloadazcopy-v10-windows | grep ^Location |
5 | 8 | # https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?tabs=dnf#obtain-a-static-download-link |
6 | | -ARG AZCOPY_URL=https://azcopyvnext-awgzd8g7aagqhzhe.b02.azurefd.net/releases/release-10.27.1-20241113/azcopy_windows_amd64_10.27.1.zip |
| 9 | +ARG AZCOPY_URL=https://azcopyvnext-awgzd8g7aagqhzhe.b02.azurefd.net/releases/release-10.29.0-20250428/azcopy_windows_amd64_10.29.0.zip |
7 | 10 |
|
8 | 11 | LABEL scubagear_version=${SCUBAGEAR_VERSION} |
9 | 12 |
|
10 | 13 | WORKDIR /app |
11 | 14 |
|
12 | 15 | # download azcopy exe to workdir |
13 | | -RUN powershell Invoke-WebRequest -Uri %AZCOPY_URL% -OutFile AzCopy.zip -UseBasicParsing |
14 | | -RUN powershell Expand-Archive .\AzCopy.zip ./AzCopy -Force |
15 | | -RUN powershell $item = Get-ChildItem .\AzCopy\*\azcopy.exe; Move-Item -Path $item -Destination . |
16 | | -RUN powershell Remove-Item AzCopy.zip; Remove-Item -r .\AzCopy |
| 16 | +RUN $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri $Env:AZCOPY_URL -OutFile AzCopy.zip -UseBasicParsing |
| 17 | +RUN Expand-Archive .\AzCopy.zip ./AzCopy -Force |
| 18 | +RUN $item = Get-ChildItem .\AzCopy\*\azcopy.exe; Move-Item -Path $item -Destination . |
| 19 | +RUN Remove-Item AzCopy.zip; Remove-Item -r .\AzCopy |
17 | 20 |
|
18 | 21 | # 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 |
22 | 25 | COPY run_container.ps1 . |
23 | 26 |
|
| 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\ContainerUser:RX' |
| 32 | +USER ContainerUser |
| 33 | + |
24 | 34 | CMD [ "powershell", ".\\run_container.ps1" ] |
0 commit comments