Created
March 18, 2020 22:07
-
-
Save mmachenry/b20c3baed66e6ddfcfea5ba05cbbeac1 to your computer and use it in GitHub Desktop.
How can I improve this Docker/Haskell build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I like that this is very simple. Only two files, the Haskell code and the Dockerfile. But | |
# there are some issues that need to be addressed. They are mentioned in the comments. | |
FROM fpco/stack-build:lts-15.4 as haskell | |
WORKDIR /opt/build | |
COPY Main.hs /opt/build | |
# This reruns on every minor code change to Main.hs and takes forever | |
RUN stack ghc --package process -- Main.hs | |
# When this is scratch or alpine, I get the error: standard_init_linux.go:211: exec user process caused "no such file or directory" | |
FROM ubuntu:latest | |
COPY --from=haskell /opt/build/Main /Main | |
ENTRYPOINT ["/Main"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Process (readProcess) | |
import Control.Monad (forever) | |
main = forever $ do | |
output <- readProcess "/bin/ls" [] "" | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment