@@ -15,18 +15,42 @@ RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
1515 --includeRecommended `
1616 || IF "%ERRORLEVEL%" =="3010" EXIT 0
1717
18- SHELL ["powershell" , "-Command" ]
18+ SHELL ["powershell" , "-ExecutionPolicy" , "Bypass" , "-Command" ]
19+
20+ # Install chocolatey
21+ RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1' ))
22+
23+ # Install packages
24+ #
25+ # We need to get the new value of `$PATH` after `choco install`, but
26+ # chocolatey's `refreshenv` won't be available until we restart the shell.
27+ # Make `refreshenv` available right away, by importing the Chocolatey profile
28+ # module. See https://stackoverflow.com/a/46760714.
29+ COPY choco-packages.txt C:\
30+ RUN $ErrorActionPreference = 'Stop' ; `
31+ choco install -y @(Get-Content C:\c hoco-packages.txt); `
32+ Import-Module "C:\P rogramData\c hocolatey\h elpers\c hocolateyProfile.psm1" ; `
33+ refreshenv
1934
2035# Install vcpkg
2136ADD https://github.com/Microsoft/vcpkg/archive/master.zip C:\T EMP\v cpkg-master.zip
2237RUN $ErrorActionPreference = 'Stop' ; `
2338 Expand-Archive -Path C:\T EMP\v cpkg-master.zip -DestinationPath .; `
39+ rm C:\T EMP\v cpkg-master.zip; `
2440 cd .\v cpkg-master; `
2541 .\b ootstrap-vcpkg.bat; `
2642 .\v cpkg integrate install
2743
28- # Install packages
44+ # Install C libraries
45+ #
46+ # The `vcpkg` crate searches for libraries matching the target architecture
47+ # exactly. It won't use x86 libraries on a 64-bit system. Setting the default
48+ # triplet tells `vcpkg` to install 64-bit versions.
49+ ENV VCPKG_DEFAULT_TRIPLET=x64-windows
2950COPY vc-packages.txt C:\
3051RUN .\v cpkg-master\v cpkg install @(Get-Content C:\v c-packages.txt)
3152
53+ # Tell the `vcpkg` crate to generate dynamically linked executables
54+ ENV VCPKGRS_DYNAMIC=1
55+
3256CMD ["powershell.exe" , "-NoLogo" , "-ExecutionPolicy" , "Bypass" ]
0 commit comments