Force Stack to use an existing Stack/GHC installation instead of re-creating one from scratch

Viewed 150

When pulling the most recent Docker Stack LTS image from Dockerhub, a full Stack installation with GHC can be found in /home/stackage/.stack.

However, when doing stack path --stack-root, Stack will forcefully rebuild an entire Stack/GHC installation into a global-project subdirectory. Even if we previously set the STACK_ROOT env variable to /home/stackage/.stack.

$ docker run --rm -it fpco/stack-build:lts-17.13 sh
$ export STACK_ROOT=/home/stackage/.stack
$ echo $(stack path --stack-root)

Writing implicit global project config file to: /home/stackage/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-17.13
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Preparing to download ghc-8.10.4 ...
ghc-8.10.4: download has begun
...

How can we force Stack to recognise the existing installation in /home/stackage/.stack and not have it create another one in /home/stackage/.stack/global-project ? Nothing in the Stack documentation seems to mention this aspect.

0 Answers
Related