-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathDockerfile-windows-gnu.template
More file actions
30 lines (26 loc) · 1.43 KB
/
Dockerfile-windows-gnu.template
File metadata and controls
30 lines (26 loc) · 1.43 KB
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=`
FROM mcr.microsoft.com/windows/servercore:%%WINDOWS-VERSION%%
SHELL ["powershell.exe", "-NoLogo", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV RUSTUP_HOME=C:\rustup `
CARGO_HOME=C:\cargo `
RUST_VERSION=%%RUST-VERSION%%
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; `
$url = 'https://static.rust-lang.org/rustup/archive/%%RUSTUP-VERSION%%/x86_64-pc-windows-msvc/rustup-init.exe'; `
$sha256 = '%%RUSTUP-SHA256%%'; `
Invoke-WebRequest -Uri $url -OutFile C:\rustup-init.exe; `
$actual256 = (Get-FileHash rustup-init.exe -Algorithm sha256).Hash; `
if ($actual256 -ne $sha256) { `
Write-Host 'FAILED!'; `
Write-Host ('expected: {0}' -f $sha256); `
Write-Host ('got: {0}' -f $actual256); `
exit 1; `
}; `
New-Item ${env:CARGO_HOME}\bin -type directory | Out-Null; `
$newPath = ('{0}\bin;{1}' -f ${env:CARGO_HOME}, ${env:PATH}); `
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine); `
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Process); `
C:\rustup-init.exe -y -v --no-modify-path --default-toolchain ${env:RUST_VERSION} --default-host x86_64-pc-windows-gnu; `
Remove-Item C:\rustup-init.exe; `
rustup -V; `
cargo -V; `
rustc -V