Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Stack added
  • Loading branch information
AlistairB committed Jan 15, 2022
commit c47e87459eeba97498c0efd6e27a7fdca2cd43ab
37 changes: 33 additions & 4 deletions 9.0/windows/windowsservercore-1809/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/windows/servercore:1809
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

# PATH isn't actually set in the Docker image, so we have to set it from within the container
RUN $newPath = ('C:\Program Files\ghc\bin;C:\Program Files\cabal-install;{0}' -f $env:PATH); \
RUN $newPath = ('C:\Program Files\ghc\bin;C:\Program Files\cabal-install;C:\Program Files\stack;{0}' -f $env:PATH); \
Write-Host ('Updating PATH: {0}' -f $newPath); \
[Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine);
# doing this first to share cache across versions more aggressively
Expand All @@ -23,11 +23,10 @@ RUN $cabalInstallVersion = '3.6.2.0'; \
}; \
\
Write-Host 'Expanding ...'; \
Expand-Archive cabal-install.zip -DestinationPath C:\; \
Expand-Archive cabal-install.zip -DestinationPath C:\cabal-install; \
\
Write-Host 'Moving ...'; \
New-Item -Path 'C:\Program Files' -Name 'cabal-install' -ItemType 'directory'; \
Move-Item -Path 'C:\cabal.exe' -Destination 'C:\Program Files\cabal-install\cabal.exe'; \
Move-Item -Path 'C:\cabal-install' -Destination 'C:\Program Files\cabal-install'; \
\
Write-Host 'Removing ...'; \
Remove-Item cabal-install.zip -Force; \
Expand Down Expand Up @@ -65,4 +64,34 @@ RUN $ghcVersion = '9.0.2'; \
\
Write-Host 'Complete.';

RUN $stackVersion = '2.7.3'; \
$url = ('https://github.com/commercialhaskell/stack/releases/download/v{0}/stack-{0}-windows-x86_64.zip' -f $stackVersion); \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile 'stack.zip'; \
\
$sha256 = '9f8c406f5ffbe72670c9499959ddab76fa8a378b4f25e3b82700c16c7fd2bad6'; \
Write-Host ('Verifying sha256 ({0}) ...' -f $sha256); \
if ((Get-FileHash stack.zip -Algorithm sha256).Hash -ne $sha256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host 'Expanding ...'; \
Expand-Archive stack.zip -DestinationPath C:\stack; \
\
Write-Host 'Moving ...'; \
# Manually create the directory and just copy the exe, we don't want the docs
New-Item -Path 'C:\Program Files' -Name 'stack' -ItemType 'directory'; \
Move-Item -Path 'C:\stack\stack.exe' -Destination 'C:\Program Files\stack\stack.exe'; \
\
Write-Host 'Removing ...'; \
Remove-Item stack.zip -Force; \
Remove-Item -Path 'C:\stack' -Recurse -Force; \
\
Write-Host 'Verifying install ("stack --version") ...'; \
stack --version; \
\
Write-Host 'Complete.';

CMD ["ghci"]