Skip to content

Commit 4e40593

Browse files
Install packages with chocolately
1 parent ae65dff commit 4e40593

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

windows/Dockerfile

+17-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@ 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:\choco-packages.txt); `
32+
Import-Module "C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1"; `
33+
refreshenv
1934

2035
# Install vcpkg
2136
ADD https://github.com/Microsoft/vcpkg/archive/master.zip C:\TEMP\vcpkg-master.zip
@@ -26,7 +41,7 @@ RUN $ErrorActionPreference = 'Stop'; `
2641
.\bootstrap-vcpkg.bat; `
2742
.\vcpkg integrate install
2843

29-
# Install packages
44+
# Install C libraries
3045
#
3146
# The `vcpkg` crate searches for libraries matching the target architecture
3247
# exactly. It won't use x86 libraries on a 64-bit system. Setting the default

windows/choco-packages.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cmake
2+
--installargs='ADD_CMAKE_TO_PATH=System'
3+
git
4+
mingw
5+
ninja

0 commit comments

Comments
 (0)