Closed mrcjkb closed 2 years ago
This could probably be solved by adding the PATH
to ~/.bashrc
:
RUN echo "export PATH=${PATH}" >> /root/.bashrc
I will test this later.
Thanks for the issue!
I'm interested to know the motivation for using a login shell? (the -l
flag to bash).
https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html suggests different files that could be used to add GHC to the PATH
.
I've done some testing on other official images and about 50% will work with a login shell. They seem to work because they happen to copy executables into /usr/local/bin
(like we do with cabal + stack) rather than doing anything with .bash_profile
etc.
I've been using docker run haskell:9.2.1 bash -lc "ghc --version"
as a minimal repro BTW.
Thanks for the hint. I ended up not needing the login shell for my project (I had copied over and modified the compose file from another project that was running end-to-end tests).
I'll close this issue, as I don't think there is a use case for building Haskell projects in a login shell.
How to reproduce
Given the following compose file
When I run
Epected
Then cabal initialises a project and /opt/ghc/9.2.1/bin is in the PATH environment variable that is printed
Actual
Then cabal fails with
The program 'ghc' version >=7.0.1 is required but it could not be found.
And the PATH is printed asPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin