From 36aad49fc89315e91a20e90b7682bd307856a2c6 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 24 Mar 2022 13:50:53 -0500 Subject: [PATCH 01/11] NEW: Add Windows docker image --- win-anvil-x86_64/.vsconfig | 22 ++++++++++++++++++++ win-anvil-x86_64/Dockerfile | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 win-anvil-x86_64/.vsconfig create mode 100644 win-anvil-x86_64/Dockerfile diff --git a/win-anvil-x86_64/.vsconfig b/win-anvil-x86_64/.vsconfig new file mode 100644 index 00000000..60fd32da --- /dev/null +++ b/win-anvil-x86_64/.vsconfig @@ -0,0 +1,22 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Component.Roslyn.Compiler", + "Microsoft.Component.MSBuild", + "Microsoft.VisualStudio.Component.CoreBuildTools", + "Microsoft.VisualStudio.Workload.MSBuildTools", + "Microsoft.VisualStudio.Component.Windows10SDK", + "Microsoft.VisualStudio.Component.VC.CoreBuildTools", + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", + "Microsoft.VisualStudio.Component.Windows10SDK.19041", + "Microsoft.VisualStudio.Component.VC.CMake.Project", + "Microsoft.VisualStudio.Component.TestTools.BuildTools", + "Microsoft.VisualStudio.Component.VC.ASAN", + "Microsoft.VisualStudio.Component.TextTemplating", + "Microsoft.VisualStudio.Component.VC.CoreIde", + "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", + "Microsoft.VisualStudio.Component.VC.v141.x86.x64", + "Microsoft.VisualStudio.Workload.VCTools" + ] +} diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile new file mode 100644 index 00000000..add81119 --- /dev/null +++ b/win-anvil-x86_64/Dockerfile @@ -0,0 +1,41 @@ +# This docker image is cached on Azure's 2019 VMs +# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md +FROM mcr.microsoft.com/windows/servercore:ltsc2019 + +SHELL ["cmd", "/S", "/C"] + +WORKDIR C:/Users/Administrator + +# Exported from Visual Studio Installer GUI, this config file is used to +# explicitly list out which MSVC components are installed. Component names are +# also documented here: +# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools +ADD .vsconfig "C:\\TEMP\\.vsconfig" + +# Be patient, this takes quite a while and you see no action. +RUN powershell -Command " \ + $url = \"https://aka.ms/vs/17/release/vs_buildtools.exe\"; \ + $client = new-object System.Net.WebClient; \ + $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ + ./msvc_build_tools.exe --quiet --wait --norestart --nocache --config C:\TEMP\.vsconfig | Write-Output; \ + Start-Sleep -s 20; \ + del msvc_build_tools.exe; \ + " + +RUN powershell -Command " \ + $url = \"https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe\"; \ + $client = new-object System.Net.WebClient; \ + $client.DownloadFile( $url, \"miniconda3.exe\"); \ + ./miniconda3.exe /S /D=C:\Users\Administrator\miniconda3 | Write-Output; \ + del miniconda3.exe; \ + ./miniconda3/Scripts/conda clean --all -y; \ + " + +RUN miniconda3\Scripts\activate.bat && \ + conda config --add channels conda-forge && \ + conda install -y conda-build git && \ + conda config --set always_yes true && \ + conda config --set anaconda_upload false + +CMD cmd.exe /k miniconda3\Scripts\activate.bat + From 8002732f2bd4cb19aa38d4876ae2a7728cacafd8 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 24 Mar 2022 16:55:03 -0500 Subject: [PATCH 02/11] Move Visual Studio layer last and cleanup TEMP --- win-anvil-x86_64/Dockerfile | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index add81119..eeee8998 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -4,29 +4,13 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019 SHELL ["cmd", "/S", "/C"] -WORKDIR C:/Users/Administrator - -# Exported from Visual Studio Installer GUI, this config file is used to -# explicitly list out which MSVC components are installed. Component names are -# also documented here: -# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools -ADD .vsconfig "C:\\TEMP\\.vsconfig" - -# Be patient, this takes quite a while and you see no action. -RUN powershell -Command " \ - $url = \"https://aka.ms/vs/17/release/vs_buildtools.exe\"; \ - $client = new-object System.Net.WebClient; \ - $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ - ./msvc_build_tools.exe --quiet --wait --norestart --nocache --config C:\TEMP\.vsconfig | Write-Output; \ - Start-Sleep -s 20; \ - del msvc_build_tools.exe; \ - " +WORKDIR C:/Users/ContainerAdministrator RUN powershell -Command " \ $url = \"https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe\"; \ $client = new-object System.Net.WebClient; \ $client.DownloadFile( $url, \"miniconda3.exe\"); \ - ./miniconda3.exe /S /D=C:\Users\Administrator\miniconda3 | Write-Output; \ + ./miniconda3.exe /S /D=C:\Users\ContainerAdministrator\miniconda3 | Write-Output; \ del miniconda3.exe; \ ./miniconda3/Scripts/conda clean --all -y; \ " @@ -39,3 +23,20 @@ RUN miniconda3\Scripts\activate.bat && \ CMD cmd.exe /k miniconda3\Scripts\activate.bat +# Put the Visual Studio layer last because it is the most annoying to redo. +# Exported from Visual Studio Installer GUI, this config file is used to +# explicitly list out which MSVC components are installed. Component names are +# also documented here: +# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools +ADD .vsconfig "C:\\TEMP\\.vsconfig" + +# Be patient, this takes quite a while and you see no action. +RUN powershell -Command " \ + $url = \"https://aka.ms/vs/17/release/vs_buildtools.exe\"; \ + $client = new-object System.Net.WebClient; \ + $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ + ./msvc_build_tools.exe --quiet --wait --norestart --nocache --config C:\TEMP\.vsconfig | Write-Output; \ + Start-Sleep -s 20; \ + del msvc_build_tools.exe; \ + Remove-Item $env:TEMP\* -Recurse; \ + " From 8e2337d861cdd2d35a12bcc9ba5047ed7725031a Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Thu, 7 Apr 2022 11:11:25 -0500 Subject: [PATCH 03/11] Try to reduce visual studio components --- win-anvil-x86_64/.vsconfig | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/win-anvil-x86_64/.vsconfig b/win-anvil-x86_64/.vsconfig index 60fd32da..097dcece 100644 --- a/win-anvil-x86_64/.vsconfig +++ b/win-anvil-x86_64/.vsconfig @@ -1,22 +1,12 @@ { "version": "1.0", "components": [ - "Microsoft.VisualStudio.Component.Roslyn.Compiler", - "Microsoft.Component.MSBuild", - "Microsoft.VisualStudio.Component.CoreBuildTools", - "Microsoft.VisualStudio.Workload.MSBuildTools", - "Microsoft.VisualStudio.Component.Windows10SDK", "Microsoft.VisualStudio.Component.VC.CoreBuildTools", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", - "Microsoft.VisualStudio.Component.Windows10SDK.19041", - "Microsoft.VisualStudio.Component.VC.CMake.Project", - "Microsoft.VisualStudio.Component.TestTools.BuildTools", - "Microsoft.VisualStudio.Component.VC.ASAN", + "Microsoft.VisualStudio.Component.Windows10SDK", "Microsoft.VisualStudio.Component.TextTemplating", - "Microsoft.VisualStudio.Component.VC.CoreIde", "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", - "Microsoft.VisualStudio.Component.VC.v141.x86.x64", - "Microsoft.VisualStudio.Workload.VCTools" + "Microsoft.VisualStudio.Component.VC.v142.x86.x64", ] } From ff0e6801104d65b241c35e3befdb9908dfcb83ec Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 11 Apr 2022 01:10:19 -0500 Subject: [PATCH 04/11] Switch to Visual Studio 15 and minimal components --- win-anvil-x86_64/.vsconfig | 9 ++------- win-anvil-x86_64/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/win-anvil-x86_64/.vsconfig b/win-anvil-x86_64/.vsconfig index 097dcece..c6927fdc 100644 --- a/win-anvil-x86_64/.vsconfig +++ b/win-anvil-x86_64/.vsconfig @@ -1,12 +1,7 @@ { "version": "1.0", "components": [ - "Microsoft.VisualStudio.Component.VC.CoreBuildTools", - "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", - "Microsoft.VisualStudio.Component.Windows10SDK", - "Microsoft.VisualStudio.Component.TextTemplating", - "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", - "Microsoft.VisualStudio.Component.VC.v142.x86.x64", + "Microsoft.VisualStudio.Workload.VCTools", + "Microsoft.VisualStudio.Component.VC.CMake.Project" ] } diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index eeee8998..f5ceb10b 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -17,7 +17,7 @@ RUN powershell -Command " \ RUN miniconda3\Scripts\activate.bat && \ conda config --add channels conda-forge && \ - conda install -y conda-build git && \ + conda install -y conda-build git mamba boa && \ conda config --set always_yes true && \ conda config --set anaconda_upload false @@ -32,7 +32,7 @@ ADD .vsconfig "C:\\TEMP\\.vsconfig" # Be patient, this takes quite a while and you see no action. RUN powershell -Command " \ - $url = \"https://aka.ms/vs/17/release/vs_buildtools.exe\"; \ + $url = \"https://aka.ms/vs/15/release/vs_buildtools.exe\"; \ $client = new-object System.Net.WebClient; \ $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ ./msvc_build_tools.exe --quiet --wait --norestart --nocache --config C:\TEMP\.vsconfig | Write-Output; \ From 467fe3925dc4499b3a618808c06b565a42ce9339 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 11 Apr 2022 01:16:09 -0500 Subject: [PATCH 05/11] Add link to download webpage --- win-anvil-x86_64/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index f5ceb10b..80d9bd3b 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -31,6 +31,7 @@ CMD cmd.exe /k miniconda3\Scripts\activate.bat ADD .vsconfig "C:\\TEMP\\.vsconfig" # Be patient, this takes quite a while and you see no action. +# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2017 RUN powershell -Command " \ $url = \"https://aka.ms/vs/15/release/vs_buildtools.exe\"; \ $client = new-object System.Net.WebClient; \ From 4b59cfa34264dd86397ed67a2208965e8ca65c27 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 11 Apr 2022 14:27:14 -0500 Subject: [PATCH 06/11] Add VS_MAJOR docker arg to win-anvil --- win-anvil-x86_64/.vsconfig | 7 ------- win-anvil-x86_64/Dockerfile | 22 +++++++++++++--------- 2 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 win-anvil-x86_64/.vsconfig diff --git a/win-anvil-x86_64/.vsconfig b/win-anvil-x86_64/.vsconfig deleted file mode 100644 index c6927fdc..00000000 --- a/win-anvil-x86_64/.vsconfig +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "1.0", - "components": [ - "Microsoft.VisualStudio.Workload.VCTools", - "Microsoft.VisualStudio.Component.VC.CMake.Project" - ] -} diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index 80d9bd3b..7df28959 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -19,24 +19,28 @@ RUN miniconda3\Scripts\activate.bat && \ conda config --add channels conda-forge && \ conda install -y conda-build git mamba boa && \ conda config --set always_yes true && \ - conda config --set anaconda_upload false + conda config --set anaconda_upload false && \ + conda update --all -n base --yes && \ + conda clean --all --yes CMD cmd.exe /k miniconda3\Scripts\activate.bat -# Put the Visual Studio layer last because it is the most annoying to redo. -# Exported from Visual Studio Installer GUI, this config file is used to -# explicitly list out which MSVC components are installed. Component names are -# also documented here: -# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools -ADD .vsconfig "C:\\TEMP\\.vsconfig" +ARG VS_MAJOR="15" +ENV VS_MAJOR=$VS_MAJOR +# Put the Visual Studio layer last because it is the most annoying to redo. # Be patient, this takes quite a while and you see no action. +# Component names are documented here: +# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools # https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2017 RUN powershell -Command " \ - $url = \"https://aka.ms/vs/15/release/vs_buildtools.exe\"; \ + $url = \"https://aka.ms/vs/$env:VS_MAJOR/release/vs_buildtools.exe\"; \ $client = new-object System.Net.WebClient; \ $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ - ./msvc_build_tools.exe --quiet --wait --norestart --nocache --config C:\TEMP\.vsconfig | Write-Output; \ + ./msvc_build_tools.exe --quiet --wait --norestart --nocache \ + --add Microsoft.VisualStudio.Workload.VCTools \ + --add Microsoft.VisualStudio.Component.VC.CMake.Project \ + | Write-Output; \ Start-Sleep -s 20; \ del msvc_build_tools.exe; \ Remove-Item $env:TEMP\* -Recurse; \ From 47b7c4a3eb540a71db543d60594c4cceeb0d0d16 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 11 Apr 2022 14:40:33 -0500 Subject: [PATCH 07/11] Prototype build step on GitHub Actions [ci skip] --- .github/workflows/ci.yaml | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2ce36b84..b3d85c20 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -318,3 +318,48 @@ jobs: DH_PASSWORD: ${{ secrets.DH_PASSWORD }} run: | ./scripts/deploy + + build_win: + name: ${{ matrix.cfg.DOCKERIMAGE }}:${{ matrix.cfg.DOCKERTAG }} + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + cfg: + - DOCKERIMAGE: win-anvil-x86_64 + DOCKERTAG: "15" + VS_MAJOR: "15" + - DOCKERIMAGE: win-anvil-x86_64 + DOCKERTAG: "16" + VS_MAJOR: "16" + - DOCKERIMAGE: win-anvil-x86_64 + DOCKERTAG: "17" + VS_MAJOR: "17" + + env: + DOCKERIMAGE: ${{ matrix.cfg.DOCKERIMAGE }} + DOCKERTAG: ${{ matrix.cfg.DOCKERTAG }} + VS_MAJOR: ${{ matrix.cfg.VS_MAJOR }} + + steps: + - uses: actions/checkout@v2 + + - name: Docker info + run: | + docker info + + - name: Build image + run: | + docker build \ + --build-arg VS_MAJOR=%VS_MAJOR% \ + -t condaforge/%DOCKERIMAGE%:%DOCKERTAG% \ + -f %DOCKERIMAGE%/Dockerfile \ + . + + - name: Deploy + if: github.ref == 'refs/heads/main' && github.repository == 'conda-forge/docker-images' + env: + CFD_QUAY_PASSWORD: ${{ secrets.CFD_QUAY_PASSWORD }} + DH_PASSWORD: ${{ secrets.DH_PASSWORD }} + run: | + ./scripts/deploy.bat From c5d3fd9b26586960bcdcd016e40be5fe715b0a40 Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Mon, 11 Apr 2022 17:11:17 -0500 Subject: [PATCH 08/11] Use Administrator account instead of ContainerAdministrator --- win-anvil-x86_64/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index 7df28959..2f613650 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -4,13 +4,13 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019 SHELL ["cmd", "/S", "/C"] -WORKDIR C:/Users/ContainerAdministrator +WORKDIR C:/Users/Administrator RUN powershell -Command " \ $url = \"https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe\"; \ $client = new-object System.Net.WebClient; \ $client.DownloadFile( $url, \"miniconda3.exe\"); \ - ./miniconda3.exe /S /D=C:\Users\ContainerAdministrator\miniconda3 | Write-Output; \ + ./miniconda3.exe /S /D=C:\Users\Administrator\miniconda3 | Write-Output; \ del miniconda3.exe; \ ./miniconda3/Scripts/conda clean --all -y; \ " From 9ea327bb92e86b01f2ffa4f5111b1f0ad967331e Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Wed, 30 Nov 2022 19:24:31 -0600 Subject: [PATCH 09/11] Only use conda-forge channel in Win container --- win-anvil-x86_64/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index 2f613650..b174416a 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -17,6 +17,7 @@ RUN powershell -Command " \ RUN miniconda3\Scripts\activate.bat && \ conda config --add channels conda-forge && \ + conda config --remove channels defaults && \ conda install -y conda-build git mamba boa && \ conda config --set always_yes true && \ conda config --set anaconda_upload false && \ From 28c5223c81b6c0d794a12ffb2d68f1c0fd483ecf Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Wed, 30 Nov 2022 20:07:41 -0600 Subject: [PATCH 10/11] Add some missing components --- win-anvil-x86_64/Dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index b174416a..b6f60cef 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -38,9 +38,18 @@ RUN powershell -Command " \ $url = \"https://aka.ms/vs/$env:VS_MAJOR/release/vs_buildtools.exe\"; \ $client = new-object System.Net.WebClient; \ $client.DownloadFile( $url, \"msvc_build_tools.exe\"); \ - ./msvc_build_tools.exe --quiet --wait --norestart --nocache \ - --add Microsoft.VisualStudio.Workload.VCTools \ + ./msvc_build_tools.exe --quiet --wait --nocache \ + --add Microsoft.Component.MSBuild \ + --add Microsoft.VisualStudio.Component.CoreBuildTools \ + --add Microsoft.VisualStudio.Component.Roslyn.Compiler \ + --add Microsoft.VisualStudio.Component.Static.Analysis.Tools \ --add Microsoft.VisualStudio.Component.VC.CMake.Project \ + --add Microsoft.VisualStudio.Component.VC.CoreBuildTools \ + --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \ + --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ + --add Microsoft.VisualStudio.Component.Windows10SDK \ + --add Microsoft.VisualStudio.Workload.MSBuildTools \ + --add Microsoft.VisualStudio.Workload.VCTools \ | Write-Output; \ Start-Sleep -s 20; \ del msvc_build_tools.exe; \ From c776cb012df699496c0864e5cfa2ac8f1934906c Mon Sep 17 00:00:00 2001 From: Daniel Ching Date: Wed, 30 Nov 2022 20:08:16 -0600 Subject: [PATCH 11/11] Make VS 16 the default --- win-anvil-x86_64/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win-anvil-x86_64/Dockerfile b/win-anvil-x86_64/Dockerfile index b6f60cef..bfbaed2f 100644 --- a/win-anvil-x86_64/Dockerfile +++ b/win-anvil-x86_64/Dockerfile @@ -26,7 +26,7 @@ RUN miniconda3\Scripts\activate.bat && \ CMD cmd.exe /k miniconda3\Scripts\activate.bat -ARG VS_MAJOR="15" +ARG VS_MAJOR="16" ENV VS_MAJOR=$VS_MAJOR # Put the Visual Studio layer last because it is the most annoying to redo.