cirruslabs / docker-images-windows

Base Windows Docker images for Cirrus CI
MIT License
6 stars 7 forks source link

Images with C build environment #5

Closed mmatuska closed 5 years ago

mmatuska commented 5 years ago

Would it be possible to create an additional image with a basic C build environment for community projects?

choco install -y --no-progress visualstudio2017community
choco install -y --no-progress visualstudio2017-workload-vctools
choco install -y --no-progress mingw
choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake || EXIT /b 1
choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake

Visual Studio 2017 takes 9 minutes to download and install, MinGW about 3 minutes.

Are custom images possible?

fkorotkov commented 5 years ago

Have you tried to use Dockerfile as CI environment feature?

mmatuska commented 5 years ago

@fkorotkov I have tested it and created three docker images:

fkorotkov commented 5 years ago

@mmatuska wow, nice! Can you share Dockerfiles for them or even create a PR with them? I'll test them and then we can pre-cache them on Cirrus. 😍

mmatuska commented 5 years ago

@fkorotkov thank you for including the image. I was also thinking about an MSYS2 and eventually Cygwin environment images. The difference here is that it would be great if they could be started with their respective bash shells instead of cmd or powershell. How can that be done?

In Cygwin you launch the shell from cmd with C:\tools\cygwin\bin\bash.exe --login -c "user_script" The problem here is that you don't start in the working directory where you checked out the git source with the windows git from your base image. To do that you need the following command form: C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; user_script"

On MSYS2 this is very similar:

set MSYSTEM=MSYS
C:\tools\msys64\usr\bin\bash\bash.exe --login -c "cd '%cd%'; user_script"
fkorotkov commented 5 years ago

@mmatuska just rebuilt VMs so now they have updated cirrus/* containers pre-cached. Which means the following now works:

windows_container:
  image: cirrusci/windowsservercore:cmake
  os_version: 2019

CIRRUS_SHELL might help with the shell issues for Cygwin and MSYS2. The caveat here is that Cirrus will still generate a batch-like script. Please create a separate issue in https://github.com/cirruslabs/cirrus-ci-docs so we can follow up on it (to make sure agent will generate Bash script if CIRRUS_SHELL point to Bash on Windows).

fkorotkov commented 5 years ago

Closing this issue since now there is cirrusci/windowsservercore:cmake image