# Use the latest Windows Server Core image.
FROM mcr.microsoft.com/windows/servercore:1809

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
  Invoke-WebRequest -UseBasicParsing -uri "https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe" -OutFile msys2.exe; \
  .\msys2.exe -y -oC:\; \
  Remove-Item msys2.exe ; \
  function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } \
  msys ' '; \
  msys 'pacman --noconfirm -Syuu'; \
  msys 'pacman --noconfirm -Syuu'; \
  msys 'pacman --noconfirm -Scc'; \
  msys 'pacman --noconfirm -S mingw64/mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-dlfcn mingw64/mingw-w64-x86_64-zlib mingw64/mingw-w64-x86_64-libmariadbclient mingw64/mingw-w64-x86_64-postgresql mingw64/mingw-w64-x86_64-sqlite3 mingw64/mingw-w64-x86_64-curl mingw64/mingw-w64-x86_64-poco mingw-w64-x86_64-cmake git';

RUN function msys() { C:\msys64\usr\bin\bash.exe @('-lc') + @Args; } \
    msys 'pacman --noconfirm -S mingw-w64-x86_64-jq'